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

前端 未结 5 1513
栀梦
栀梦 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 19:06

    None of the "popular" answers for this question are correct or working. Some of them have nothing to even do with the question being asked. I have the same problem.

    SDL docs give an example for compiling like this: gcc -o main main.c `sdl2-config --cflags --libs`

    Yet user is suggesting that it is order of arguments causing the problem!! It is not! In fact, their suggested order is something I have never seen before and is certainly not any kind of standard. SDL answers on this site are very low quality!

    Update: I found a solution for some missing functions. SDL_SetVideoMode does not exist in SDL2. Use SDL_CreateWindow.

提交回复
热议问题