PDA

View Full Version : [SDL] undefined reference to `SDL_GetKeyState'



chronozphere
04-06-2010, 07:34 AM
Hey,

I'm trying to compile my engine on linux, but I get the following error:



/n3d/workingdir/src/n3d_input.pas:687: undefined reference to `SDL_GetKeyState'
meshtestproj.lpr(241,1) Error: Error while linking


I guess there is a problem with my SDL library. It's staticly linked, so that makes perfect sense.

Any idea's how to fix this?

Thanks :)

chronozphere
04-06-2010, 08:11 AM
Ok, I got a big clue. :P

I used:



locate SDL.so

/home/*username*/dev/SDL1.3/sdl/build/.libs/libSDL.so
/usr/local/lib/libSDL.so



To find the library file.

Then I checked both libraries with the following command:



nm -D /usr/local/lib/libSDL.so | grep SDL_GetK

000358e0 T SDL_GetKeyFromScancode
00036260 T SDL_GetKeyName
0000ae10 T SDL_GetKeyRepeat
00035810 T SDL_GetKeyboardState


According to the SDL docs, sdl 1.2 (which I am using now) has SDL_GetKeyState() while 1.3 has SDL_GetKeyboardState. So both files are SDL1.3.

So I need the *.so for SDL1.2. I don't want to get rid of my 1.3 library because it was quite a struggle (for me as a beginner) to set it up.

Can anyone tell me what I need to do to make sure SDL1.2 is linked to my project-code instead of 1.3, without destroying the 1.3 installation?

Thanks. :)