我所面临的情况与Gustavo在下面的Link中提出的问题完全相同。此外,我已经尝试了在该链接和其他标记中发布的所有解决方案(比如将库名从opus.a更改为libopus.a,更改'\‘到'/’等等),但这些都没有解决我的问题。通过打开库文件的属性,可以显示以下内容:
路径: /demo/opusfile/libopusfile.a
类型:文件(静态库)
U:\data\Jag\eclipse\wrksp\demo\opusfile\libopusfile.a:Location
明图显示的错误消息如下:
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有人能告诉我我错过了什么吗?我无法解决这个问题。
发布于 2014-09-12 09:52:34
我想我找到了解决方案,多亏了这个Link上的答案。因此,基本上,为了总结解决方案,在指定库(.a参数)时,我必须删除'lib‘前缀、’-l‘后缀和库路径。库路径必须在-L参数中指定。这解决了上述问题,但却导致了明格的另一个障碍:
libopusfile.dll.a: could not read symbols: Archive has no index; run ranlib to add one.我在命令提示符中执行了'ranlib‘命令
cmd_path> ranlib libopusfile.dll.a ,正如编译器所建议的那样,这解决了我所有的问题!
https://stackoverflow.com/questions/25789826
复制相似问题