简体   繁体   中英

How to add the built from source boost library to qt creator on linux

I compiled the boost library from the source using the scripts that came with the source (below the commands that I wrote)

/bootstrap.sh —prefix=/libs

./b2 install

After the build, 2 new directories appeared in the libs directory, include and lib, respectively. 在此处输入图像描述

Next, I registered the path to boost in the pro file qt creator

TEMPLATE = app
CONFIG += console c++17
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += \
main.cpp

INCLUDEPATH += I-/libs/include/boost

LIBS += -L/libs/lib

In theory, I specified the path to both the headers (include / boost) and the binaries (lib), but nevertheless, when I try to compile the test code, I get a bunch of errors. How to correctly register a pro file if I want to connect asio, on Linux, where did I go wrong? (set of errors)

You are not giving the library name in LIBS , only giving the path. Correct format is:

LIBS += -L<pathToLibrary> -l<libraryName>

Moreover INCLUDEPATH syntax is also incorrect. There's no need for I- .


INCLUDEPATH += /path/to/library
# e.g
INCLUDEPATH += libs/include/boost

And btw you don't need to link to anything if you are using asio only, since as far as I remember, Asio is header only so only include path will be necessary.

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