未定义的符号引用,即使库已链接

Mat*_*lem 10 c++ linker codeblocks

链接我正在处理的项目时,链接器会出现以下错误:

/usr/bin/ld: ../Includes and Libs/lib/libsfml21rca.a(SoundFile.o): undefined reference to symbol 'sf_read_short@@libsndfile.so.1.0'

/usr/bin/ld: note: 'sf_read_short@@libsndfile.so.1.0' is defined in DSO /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/libsndfile.so so try adding it to the linker command line

/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/libsndfile.so: could not read symbols: Invalid operation
Run Code Online (Sandbox Code Playgroud)

问题是,libsndfile.so已经在libsfml21rca.a之前链接了,所以我不知道问题出在哪里.

我正在使用Code :: Blocks 10.05

提前感谢您的帮助

编辑:

这是链接命令:

g ++ -L"包含和Libs/lib"-L"包含和Libs/lib/raknet3_731"-L"包含和Libs/lib/d3d_new/x86"-L"包含和Libs/lib/ogg"-L"包含和Libs/lib/sdl"-LBullet/lib -o(filename)...(很多目标文件)-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

Mat*_*son 8

链接器仅对库文件运行一次传递.因此,如果您在库A中有某些东西需要库B中的某些东西,那么您需要拥有它g++ objects... -llibA -llibB,如果您使用g++ objects... -llibB -llibA它将以您显示的方式失败.

所以,在你的情况下,把-lsndfile"../Includes and Libs/lib/libsfml21rca.a".

(而且他的想法是在"包含和库"目录中放置空格 - 这不是我见过的最好的主意......)