Help to use Boost libraries in QtCreator on Windows 7
-
Hi everyone,
I have Qt Creator installed on Windows 7 and I have download and build Boost 1.62, so in C:\Boost I think that I have all the files I need to use Boost libraries. But now, I want to create a little graphical messaging service using Qt and Boost.Asio. But I'm a begginer and even if I have basically understood the different stages of compilation, I have some difficulties to correctly configure Qt tu use Boost. A priori, I need to write something in the .pro file of my project but I don't understand very well what I need to put in this file, so if someone could help me, it would be very nice :)
Thibault. -
Hi and welcome to devnet forum
Boost has different parts.
Some parts are simply based on templates which are all in include files. There you to make sure that the boost folder is included in the
INCLUDEPATH of your project.Other parts require a separate compilation and creation of a library. I am not sure about ASIO, but I guess you need to compile. For this you need to follow the instrcution given with boost and use the same compiler as you plan to use with Qt.
However, are you sure that you need ASIO?
There might be the same functionality available in Qt. -
Hi, thank you for your reply,
I have already putINCLUDEPATH += C:\Boost
in my .pro file, and yes, Asio require a separate compilation and the creation of a library.
I have already done it but for MinGW, I choose this one because Qt is using cmake so I thought that MinGW was the right choice. Do I need to rebuild Boost for another compiler or is MinGW ok ?
In the Boost's documentation, there is no instruction for the Qt Creator configuration but I think that I need to put something in my .pro file related to the linker, no ?
And yes there are probably the same functionnalities in Qt but maybe I will also use other Boost libraries (if I manage to use it) like Boost.Regex or Boost.FileSystem. -
You need to add
INCLUDEPATH += C:/Boost
In general you make your life easier when using the forward slash with Qt files. The backward slash is used in most Qt based stuff for continuation lines.
I would recommend to compile boost libs with the very same MinGW compiler as it is used for Qt prebuild. It is not always clear if the different compiler versions are fully compatible.
ASIO is serial and network I/O to my understanding. This is provided also by Qt. The same is for RegEx and FileSystem.
Personally I have thrown out my use of boost regex and switched to Qt's implementation because of the required recompilation of libs for boost. However, I am using boost smart pointers and others which rely only on includes.
-
@koahnig
Ok thank you, I will try !