error in compiling SDL code using gcc
Hello all,
I'm a newbie with linux and I'm getting an error when I try to compile my SDL program with gcc. Here's the command line I'm using to compile it: $ gcc -o comp fosdl9_3.c -lSDL_ttf -lSDL -I/usr/include/SDL -I/usr/local/include/SDL And here is the error message it's giving me: /usr/bin/ld: /tmp/ccr3zqbS.o: undefined reference to symbol 'sin@@GLIBC_2.0' /usr/bin/ld: not: 'sin@@GLIBC_2.0' is defined in DSO /lib/libm.so.6 so try adding it to the linker command line /lib/libm.so.6: could not read symbols: Invalid operation collect2: ld returned 1 exit status I'm assuming this means I have to add "libm.so.6 to the compile command line, but I'm not sure how to do that. Any help or advice would be greatly appreciated! Thanks in advance! |
Quote:
Code:
$ gcc -o comp fosdl9_3.c -lm -lSDL_ttf -lSDL -I/usr/include/SDL -I/usr/local/include/SDL |
Quote:
src2pkg aborted without giving any useful error messages. So I made a slackbuild script and when I ran it, I got the same error message as in the OP. The problem was to include the "-lm" without patching the Makefile or config file. The solution was to modify cwstation.SlackBuild as follows: Code:
make LDFLAGS="-lm" || exit |
More generally, if ld is spitting out "undefined reference to symbol 'foo'" "'foo' is defined in DSO 'libbar.so'", you want to add -lbar to your linking options, assuming the library actually exists.
|
All times are GMT -5. The time now is 05:07 AM. |