gcc编译器无法找到外部库

时间:2014-03-21 17:49:33

标签: c++ regex eclipse gcc boost

我对Boost库有疑问。我编译了它,我可以在项目中使用该库。现在我做了一个新项目并希望包括在内。我在链接器和C ++编译器中添加了库。我正在使用Eclipse

这是我的编译器输出:

18:45:16 **** Incremental Build of configuration Debug for project Asterretje ****
Info: Internal Builder is used for build
g++ -o Asterretje.exe main.o Vertex.o RouteCalculator.o Reader.o Graph.o Edge.o -llibboost_regex-mgw48-mt-1_55 
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -llibboost_regex-mgw48-mt-1_55
collect2.exe: error: ld returned 1 exit status

18:45:17 Build Finished (took 915ms)

有谁知道如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

添加开关-L<dir>,其中<dir>是boost库的目录。你应该首先削减&lib;来自库文件名的部分,例如libmylib.so,你应该传递-lmylib

答案 1 :(得分:0)

感谢所有帮助

我发现了这个问题。我忘了插入搜索路径。