如何在qmake项目中使用Boost库? [英] How do I use the Boost libraries in a qmake project?
问题描述
有些天前我编译了Boost版本。 VS2012为1.53.0。它工作正常,编译精细。现在我想使用Boost与Qt Creator。在 .pro
文件中包含
INCLUDEPATH + = C :\boost\boost_1_53_0\ -lboost_filesystem
LIBS + = C:/ boost / boost_1_53_0 / stage / lib /
但是当我编译时,我得到2个错误:
: - 1:error:can not find C :/ boost / boost_1_53_0 / stage / lib /:权限被拒绝
collect2.exe:-1:错误:错误:ld返回1退出状态
我该怎么办?我已经google了,但似乎是第一个出现这个错误。
INCLUDEPATH + = C:\boost\boost_1_53_0\ -lboost_filesystem
LIBS + = C:/ boost / boost_1_53_0 / stage / lib /
错误。
阅读此。
解决方案:
INCLUDEPATH + = C:/ boost / boost_1_53_0 /
LIBS + =-LC:/ boost / boost_1_53_0 / stage / lib /
Boost有复杂的库名(libboost_filesystem-vc90-mt-1_53.lib),如果是msvc,它会自动链接。)
如果要链接其他lib,您可以这样做:LIBS + =-LMyLibraryPath-lmylib
其中MyLibraryPath是库路径,mylib是您要链接的库。
我是第一个出现此错误的人。
可能发生,因为编译器尝试打开目录,如果它是一个文件或类似的东西。
Some days ago I compiled Boost ver. 1.53.0 for VS2012. It works fine, compiles fine. Now I want to use Boost with Qt Creator. In the
.pro
file I've includedINCLUDEPATH += C:\boost\boost_1_53_0\ -lboost_filesystem LIBS += C:/boost/boost_1_53_0/stage/lib/
But when I compile I get 2 errors:
:-1: error: cannot find C:/boost/boost_1_53_0/stage/lib/: Permission denied collect2.exe:-1: error: error: ld returned 1 exit status
What should I do? I've googled but seems I'm the first with this error.
解决方案INCLUDEPATH += C:\boost\boost_1_53_0\ -lboost_filesystem LIBS += C:/boost/boost_1_53_0/stage/lib/
Wrong.
Solution:
INCLUDEPATH += C:/boost/boost_1_53_0/ LIBS += "-LC:/boost/boost_1_53_0/stage/lib/"
Boost has complicated library names ("libboost_filesystem-vc90-mt-1_53.lib") and in case of msvc it links them automatically.) If you want to link additional lib, you do it like this:
LIBS += "-LMyLibraryPath" -lmylib
Where MyLibraryPath is library path, and mylib is library you want to link with.
i'm the first with this error.
The error most likely occurs because compiler tries to open directory as if it were a file or something like that.
这篇关于如何在qmake项目中使用Boost库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!