SDL 2 Undefined Reference to “WinMain@16” and several SDL functions

后端 未结 7 1049
一整个雨季
一整个雨季 2020-12-06 19:41

I\'ve just installed SDL 2 and I have some serious problems. This is my code:

#include 

int main(int argc, char* argv[]){
SDL_Init( SDL_I         


        
7条回答
  •  日久生厌
    2020-12-06 20:04

    Although the accepted answer works (if you follow it exactly, or read the comments), there's one caveat: You have to follow the order of linking libraries as given

    g++ 01_hello_SDL.cpp -I{add correct path here}/include/SDL2 -L{add correct path here}/lib -lmingw32 -lSDL2main -lSDL2

    And if you dont want a console to run alongside the window, add -mwindows to the options

提交回复
热议问题