c++ - Undefined reference to symbol, even though the library is linked -


when linking project working on, linker gives following errors:

/usr/bin/ld: ../includes , libs/lib/libsfml21rca.a(soundfile.o): undefined reference symbol 'sf_read_short@@libsndfile.so.1.0'  /usr/bin/ld: note: 'sf_read_short@@libsndfile.so.1.0' defined in dso /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/libsndfile.so try adding linker command line  /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/libsndfile.so: not read symbols: invalid operation 

the thing is, libsndfile.so linked before libsfml21rca.a, have no idea problem is.

i'm using code::blocks 10.05

thanks in advance

edit:

here linking command:

g++ -l"includes , libs/lib" -l"includes , libs/lib/raknet3_731" -l"includes , libs/lib/d3d_new/x86" -l"includes , libs/lib/ogg" -l"includes , libs/lib/sdl" -lbullet/lib -o (filename) ...(a whole lot of object files) -lglew -lglfw -lgl -lglu -lpthread -lopenal -ljpeg -lfreetype -lsndfile -lxrandr -lsfml-system -lsfml-window -lsfml-audio ../bullet/lib/linearmath.lib ../bullet/lib/bulletcollision.lib ../bullet/lib/bulletdynamics.lib "../includes , libs/lib/raknet3_731/raknetlibstaticdebug.lib" "../includes , libs/lib/libsfml21rca.a" ../../../../../../home/msabol/desktop/sfml/sfml2st/sfmlvideo/sfmlvideo/bin/release/libsfmlvideo.a ../../../../../../home/msabol/desktop/sfml/sfmlvideo/bin/release/libsfmlvideo.a

the linker runs 1 pass on library files. if have in library needs in library b, need have g++ objects... -lliba -llibb, if use g++ objects... -llibb -lliba fail in manner show.

so, in case, put -lsndfile after "../includes , libs/lib/libsfml21rca.a".

(and idea put spaces in "includes , libs" directory - not best idea i've seen...)


Comments