简体   繁体   English

如何在qmake项目中使用Boost库?

[英]How do I use the Boost libraries in a qmake project?

Some days ago I compiled Boost ver. 前几天我编译了Boost ver。 1.53.0 for VS2012. VS2012为1.53.0。 It works fine, compiles fine. 它工作正常,编译很好。 Now I want to use Boost with Qt Creator. 现在我想在Qt Creator中使用Boost。 In the .pro file I've included 在我包含的.pro文件中

INCLUDEPATH += 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: 但是当我编译时,我得到2个错误:

:-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. 我用Google搜索,但似乎我是第一个出现此错误的人。

INCLUDEPATH += C:\boost\boost_1_53_0\  -lboost_filesystem
LIBS += C:/boost/boost_1_53_0/stage/lib/

Wrong. 错误。

Read this . 读这个

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: Boost具有复杂的库名称(“libboost_filesystem-vc90-mt-1_53.lib”),并且在msvc的情况下,它会自动链接它们。)如果要链接其他lib,可以这样做:

LIBS += "-LMyLibraryPath" -lmylib

Where MyLibraryPath is library path, and mylib is library you want to link with. MyLibraryPath是库路径,mylib是您要链接的库。

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. 错误最有可能发生,因为编译器尝试打开目录,就好像它是一个文件或类似的东西。

win32 {
    INCLUDEPATH += C:/Users/User/Downloads/dev/boost_1_61_0
    LIBS += "-LC:/dev/Boost/lib/" \
    "-Llibboost_filesystem-mgw53-mt-d-1_61.a", "-Llibboost_system-mgw53-mt-d-1_61.a", "-Llibboost_serialization-mgw53-mt-d-1_61.a" -LLIBS

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM