Mingw和Eclipse无法找到库-2
我面临的情况与古斯塔沃在下文中提出的问题完全相同。此外,我还尝试了该链接和其他标签中发布的所有解决方案(例如将库名从opus.a更改为libopus.a,将“\”更改为“/”等等),但这些都没有解决我的问题。通过打开库文件的属性,将显示以下内容: 路径:/demo/opusfile/libopusfile.a 类型:文件(静态库) 位置:U:\data\Jag\eclipse\wrksp\demo\opusfile\libopusfile.a Mingw显示的错误消息如下:Mingw和Eclipse无法找到库-2,c,eclipse,mingw,static-libraries,opus,C,Eclipse,Mingw,Static Libraries,Opus,我面临的情况与古斯塔沃在下文中提出的问题完全相同。此外,我还尝试了该链接和其他标签中发布的所有解决方案(例如将库名从opus.a更改为libopus.a,将“\”更改为“/”等等),但这些都没有解决我的问题。通过打开库文件的属性,将显示以下内容: 路径:/demo/opusfile/libopusfile.a 类型:文件(静态库) 位置:U:\data\Jag\eclipse\wrksp\demo\opusfile\libopusfile.a Mingw显示的错误消息如下: 15:56:57 *
15:56:57 **** Incremental Build of configuration Debug for project demo ****
Info: Internal Builder is used for build
gcc -o demo.exe "src\\demo.o" -lU:/data/Jag/eclipse/wrksp/demo/opusfile/libopusfile.a
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lU:/data/Jag/eclipse/wrksp/demo/opusfile/libopusfile.a
collect2.exe: error: ld returned 1 exit status
collect2.exe: error: ld returned 1 exit status
有人能告诉我我错过了什么吗?我无法解决此问题我想我找到了解决方案,这要感谢本文中发布的答案。因此,基本上为了总结解决方案,我必须在指定库(-l参数)时删除'lib'前缀、'.a'后缀和库路径。必须在-L参数中指定库路径。这解决了上述问题,但也给Mingw带来了另一个障碍:
libopusfile.dll.a: could not read symbols: Archive has no index; run ranlib to add one.
我在命令提示符下执行了“ranlib”命令
cmd_path> ranlib libopusfile.dll.a
,这解决了我所有的问题