SDL 2 Undefined Reference to "WinMain@16" and several SDL functions

I think you want

#define SDL_MAIN_HANDLED

in your main file, BEFORE the line

#include <SDL2/SDL.h>

from: https://stackoverflow.com/a/32343111/5214543


post the compiler commands. ex: g++/gcc ....

you are probably not linking the library.

http://content.gpwiki.org/index.php/SDL:Tutorials:Setup you should have the path to the lib, included in the ide. (I see you are using codeblocks)

add to the linker settings: -lmingw32 -lSDLmain -lSDL

http://www.sdltutorials.com/sdl-tutorial-basics


You need to add these to linker libraries with the same order:

mingw32
SDL2main
SDL2

Note that the order is important.

Tags:

C++

Sdl