0

I have this snippet of code:

#include <SDL2/SDL.h>
#include <iostream>

int main(int argc, char* argv[]) {
    std::cout << "!!!Hello World!!!" << std::endl;
    return 0;
}

The error reported is this:

Info: Internal Builder is used for build g++ -o cavestory-developement.exe "src\cavestory-developement.o" -lmingw32 -lSDL2main -lSDL2 c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(main.o):(.text.startup+0xc0): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status

17:13:45 Build Failed. 1 errors, 0 warnings. (took 205ms)

Any help solving this problem would be greatly appreciated.

stateMachine
  • 5,227
  • 4
  • 13
  • 29
John
  • 23
  • 6
  • 1
    https://stackoverflow.com/questions/17048072/sdl-2-undefined-reference-to-winmain16-and-several-sdl-functions – Andy Aug 15 '20 at 00:34
  • o thank you andy, i tried #define SDL_MAIN_HANDLED, and it seems to have worked. I tried before but i didn't save before building. – John Aug 15 '20 at 00:41

0 Answers0