Linking problems

Started by
1 comment, last by Rickmeister 18 years, 9 months ago
Hi all.. Old forum geezer, but new to Linux.. I've just installed Linux on my comp and is now running dual boot with Mandrake LE 2005 and Windows XP. The reason for this is to be able to test out my code under Linux as I'm trying to write portable code. I'm using SDL paired with GL and I've also implemented a rudimentary script language support using Lua. The game is somewhat playable right now using my crappy coder-graphics, but it's not meant to become a kick-ass game, but rather as a educational project as I've never done any sort of development under any other OS then Windows (I ruled out Amiga OS as it's a decade since I last had an Amiga). I'm using Eclipse+GCC (MinGW32) in XP and Eclipse+Gcc3.4.3 in linux so I had my hope that the transition would be a piece of cake, but I ran into trouble.. I've narrowed the problems down to about a few hundred lines of code [smile] but the code is not what's causing the trouble, it's ld complaining about undefined references

/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `log'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `sqrt'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `dlerror'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `dlclose'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `fmod'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `cos'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `sin'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `atan2'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `dlopen'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `pow'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `log10'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `dlsym'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `exp'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `tan'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `atan'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `asin'
/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../liblualib.so: undefined reference to `acos'
For those who don't know, I'm trying to link this code with liblualib.a aswell as liblua.a, but it bites me. Under Windows it works fine, so I suppose it's me beeing lame. I've tried recompiling Lua, as I got that tip elsewhere, but no luck. I've also made sure that the compiler finds all the neccessary header and library files, but still no luck.. What am I doing wrong here??
Advertisement
Try to add -lm and -ldl to your linker command.
duh! Can it be that simple...?? Gotta reboot and check..

[edit]
Worked like a charm, thanks again SiCrane for helping me out. I Knew there was something I've been missing. Now, the game doesn't work but that's probably because some other issues, but atleast it compiles and links ok.

This topic is closed to new replies.

Advertisement