Skip to content

type 'double' cannot be narrowed to 'int' in initializer list [-Wc++11-narrowing] #23

Description

@LucasMW

main.cpp:17:93: warning: variable 'player' is uninitialized when used within its
own initialization [-Wuninitialized]
...player(platforms[0].getX() + platforms[0].getWidth()/2 - 26/2, platforms[0].getY() - player...
~~~~~~ ^~~~~~
main.cpp:318:50: error: type 'double' cannot be narrowed to 'int' in initializer
list [-Wc++11-narrowing]
...SDL_Rect platformSprite_rect = { platforms[i].getX(), platforms[i].getY(...
^~~~~~~~~~~~~~~~~~~
main.cpp:318:50: note: insert an explicit cast to silence this issue
...SDL_Rect platformSprite_rect = { platforms[i].getX(), platforms[i].getY(...
^~~~~~~~~~~~~~~~~~~
static_cast( )
main.cpp:318:71: error: type 'double' cannot be narrowed to 'int' in initializer
list [-Wc++11-narrowing]
...platformSprite_rect = { platforms[i].getX(), platforms[i].getY(), 100, 3...
^~~~~~~~~~~~~~~~~~~
main.cpp:318:71: note: insert an explicit cast to silence this issue
...platformSprite_rect = { platforms[i].getX(), platforms[i].getY(), 100, 3...
^~~~~~~~~~~~~~~~~~~
static_cast( )
main.cpp:327:44: error: type 'double' cannot be narrowed to 'int' in initializer
list [-Wc++11-narrowing]
SDL_Rect playerSprite_rect = { player.getX(), player.getY()...
^~~~~~~~~~~~~
main.cpp:327:44: note: insert an explicit cast to silence this issue
SDL_Rect playerSprite_rect = { player.getX(), player.getY()...
^~~~~~~~~~~~~
static_cast( )
main.cpp:327:59: error: type 'double' cannot be narrowed to 'int' in initializer
list [-Wc++11-narrowing]
...SDL_Rect playerSprite_rect = { player.getX(), player.getY(), 32, 32 };
^~~~~~~~~~~~~
main.cpp:327:59: note: insert an explicit cast to silence this issue
...SDL_Rect playerSprite_rect = { player.getX(), player.getY(), 32, 32 };
^~~~~~~~~~~~~
static_cast( )
main.cpp:330:45: error: type 'double' cannot be narrowed to 'int' in initializer
list [-Wc++11-narrowing]
SDL_Rect lavaSprite_rect = { 0, lavaY, 800, 48 };
^~~~~
main.cpp:330:45: note: insert an explicit cast to silence this issue
SDL_Rect lavaSprite_rect = { 0, lavaY, 800, 48 };
^~~~~
static_cast( )
1 warning and 5 errors generated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions