gcc won't compile SDL C Program (undefined reference to SDL functions)

前端 未结 5 1515
栀梦
栀梦 2021-01-14 18:32

I recently moved to linux and i\'m having an issue with compiling SDL C programs using gcc.

The command i\'m using:

gcc `sdl-config --cflags --libs`          


        
5条回答
  •  感情败类
    2021-01-14 18:48

    Add -lSDL with gcc compile command. This will add sdl library. Install sdl developement package before compiling.

    EDIT:

    gcc -o out main.c -lSDL
    

    or

    gcc -I/usr/include/SDL/ main.c -o out -L/usr/lib -lSDL
    

提交回复
热议问题