A la suite de ce sujet, voilà un début de contribution à la FAQ :
-----
Pourquoi ai-je une erreur "undefined reference to 'WinMain@16 quand je compile mon projet SDL ? (Windows)
Cette erreur est due à l'oublie de lier les bibliothèques.
Ajouter aux options de l'éditeur de liens -lmingw32 -lSDLmain -lSDL (Code::Blocks / gcc...)
SDLmain.lib pour VisualC++
-----
Pourquoi j'obteins ce message quand je compile ?
Réponse : Il faut linker SDLmain avant SDL.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 \mingw\lib\libSDLmain.a(SDL_win32_main.o):: In function `console_main':/home/hercules/public_cvs/SDL/src/main/win32/SDL_win32_main.c:198: undefined reference to `SDL_strlcpy' :\home\hercules\public_cvs\SDL\src\main\win32\SDL_win32_main.c:214: undefined reference to `SDL_SetModuleHandle' \mingw\lib\libSDLmain.a(SDL_win32_main.o):: In function `WinMain':/home/hercules/public_cvs/SDL/src/main/win32/SDL_win32_main.c:274: undefined reference to `SDL_strlcpy' :\home\hercules\public_cvs\SDL\src\main\win32\SDL_win32_main.c:275: undefined reference to `SDL_strlcat' :\home\hercules\public_cvs\SDL\src\main\win32\SDL_win32_main.c:298: undefined reference to `SDL_strlcpy' :\home\hercules\public_cvs\SDL\src\main\win32\SDL_win32_main.c:299: undefined reference to `SDL_strlcat' :\home\hercules\public_cvs\SDL\src\main\win32\SDL_win32_main.c:341: undefined reference to `SDL_strlcpy' :: === Build finished: 5 errors, 0 warnings ===
---------
Pour les "undefined references" autant traduire la FAQ à ce sujet ?
Rappel :
Q: I get undefined references to various SDL functions...
A: When you're compiling with gcc, you need to make sure the output of sdl-config follows your source file on the command line:
gcc -o test test.c `sdl-config --cflags --libs`
If you're getting undefined references to functions in SDL_image or SDL_mixer, make sure you're actually linking with those libraries as well.
Je ne sait pas s'il y a d'autres erreurs du style. Les tests et messages ont été fait avec Code::Blocks + MinGW
Partager