How to use SDL with gcc?

后端 未结 1 376
情深已故
情深已故 2021-01-29 03:40

I download SDL source at \'https://www.libsdl.org\'

I use cmake and get library.

libSDL2.a
libSDL2main.a
libSDL2-2.0.so
libSDL2-2.0.so.0
libSDL2-2.0.so.0         


        
1条回答
  •  礼貌的吻别
    2021-01-29 04:29

    You must add -lpthread before other libs to link threading support.

    You should also enable a bit more warning option: -Wextra -pedantic

    So

    gcc -W -Wall -Wextra -pedantic -o main main.c -Iinclude -lpthread -Llib -lSDL2 -lSDL2main
    

    0 讨论(0)
提交回复
热议问题