undefined reference to `SDL_Quit'
/tmp/ccSHyKZe.o: In function `main':
mouse.c:(.text+0x27): undefined reference to `SDL_Init' mouse.c:(.text+0x4b): undefined reference to `SDL_SetVideoMode' mouse.c:(.text+0x9d): undefined reference to `SDL_Quit' collect2: ld returned 1 exit status Anyone know why I might get an error of undefined reference to SDL_Init, SDL_SetVideoMode, and SDL_Quit... even though I have #include <SDL/SDL.h> with the correct path to the file in my code. |
Are you linking the library as well?
|
I am trying to compile the code below on Fedora Core 6 [even tried Fedora Core 7] with the command
gcc -lX11 -L/usr/X11R6/lib -I/usr/X11R6/include -o go.exe mouse.c Code:
#include <stdio.h> |
Doesn't look like you're linking SDL, only X11. See the documentation for how to link the SDL library, it may just be a case of using -lsdl or something similar, or there may be a program that'll generate the required flags for you.
|
See the SDL FAQ's and this type of question is one that I hate the most, as it translates to "I am too lazy to look for myself, will someone else do it for me?"
[rant off]If you did not know this was a linker error then simply by ctrl-c and ctrl-v into google (example:undefined reference to `SDL_Init') and this would have brought a vast number of similar posts from other people. Some of which would give the same response as I(small rant) others would be more informative and supply links and answers. My I also ask why you are redefining the SDL events? |
All times are GMT -5. The time now is 05:06 PM. |