A
A
Artem2015-08-14 12:30:59
Qt
Artem, 2015-08-14 12:30:59

How to connect Boost to Qt Creator?

You need to connect the boost / asio library to the project (pure C ++ console application for practice) in qt creator.
I downloaded the sources from the site. I read that asio does not need to be built and everything is in headers.
I read in Google that it is enough to add a directory to INCLUDEPATH += .
Added INCLUDEPATH += C:/WORK/boost_1_59_0.
After that, auto-completion works in the editor in #include "boost/asio.hpp".
But when compiling, it gives

C1083: Cannot open include file: 'boost/asio.hpp': No such file or directory

I ran qmake - it began to display
C1083: Cannot open include file: 'winsock2.h': No such file or directory

q7csNW5.png
It is in one of the headers that another header is connected that it cannot find.
Connected the correct assembly kit.
began to issue
LINK : fatal error LNK1104: cannot open file 'libboost_system-vc120-mt-gd-1_59.lib'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2015-08-14
@JustSokol

In general, everything was decided by the fact that it was necessary to correctly write everything to the project file (* .pro) and press qmake.
At the same time, although the original library (asio) is based only on headers and implementations, it uses other Boost libraries and, accordingly, includes / includes them when the corresponding .hpp is included.
That is, it was necessary to pre-assemble the entire boost with your compiler in either, or download ready-made ones for Windows from the off site.
As a result, the .pro file is added

INCLUDEPATH += C:/WORK/boost_1_59_0
LIBS += "-LC:\WORK\boost_1_59_0\lib64-msvc-12.0"

pressing qmake and then everything is going.
PS: it turned out that he asked - he answered.
but I hope next time someone will quickly find the problem in the search engine and see the solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question