简体   繁体   中英

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

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 included

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:

:-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.

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:

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.

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

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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