11

I created a Qt project in Ubuntu and everything went smoothly. However, I also need deploy it on Windows. It uses Boost libraries(the big problem).

I've been searching for hours to find a solution, but didn't have luck. I tried to install Boost libraries and link it with mingw; I think I missed something. Here is what I did and downloading the lastest version:

1) ran .\bootstrap
2) then .\b2 --prefix=C:\boost install

Sadly didn't install correctly. I got only 2 folder(bin and share) but no headers.

However, here (http://nuwen.net/) I found a bundle(Mingw+Boost and other libraries). This has everything I need.

Now I think the issue is .pro file, because I have a lot of undefined references. Here is .pro file with everything I tried (some commented): http://pastebin.com/pBFMTAd8

Your help is appreciated!

suspectus
  • 16,548
  • 8
  • 49
  • 57
Athan
  • 777
  • 2
  • 7
  • 21
  • A few error messages would be nice. And can you confirm that your boost libs are in C:/MinGW/lib? – Greenflow Sep 01 '13 at 20:43
  • My bad, here are some errors: http://postimg.org/image/h4vvo8mgx/9040bd30/ ; and here is the path C:\MinGW\lib: http://postimg.org/image/3lw19jdt9/ad5481f9/ – Athan Sep 01 '13 at 21:06
  • I see only .a boost libs. Nothing in your .pro files indicates that you do a static build. Are there also the boost .dll files in this folder? – Greenflow Sep 01 '13 at 21:09
  • There are only .a boost libs. I tried now with a static configuration, but doesn't change anything. All I want is to deploy it, whether is a static or dynamic build. Can you help me further? – Athan Sep 02 '13 at 05:23

2 Answers2

12

I did solve the problem myself. And here is how I did it. First of all, it is required to have boost library compiled with same compiler you're using with Qt.
If you're using msvc, then you're lucky because Boost guys did you a favour and compiled libraries for you. You can download them here: http://sourceforge.net/projects/boost/files/boost-binaries/ .
If you're using mingw (which does come in bundle with Qt), you can do this:

  • add mingw compiler to Windows PATH variable:
    ~ go to control panel and search for System;
    ~ add mingw's path(e.g. C:\Qt\Tools\mingw\bin) to PATH variable by appending ';' to your path(e.g.: ";C:\Qt\Tools\mingw\bin")
  • compile Boost libraries:
    ~ unzip boost archive
    ~ open a Command Line window, go in the unzipped boost folder, then go in folder tools/build/v2/engine
    ~ you have you build installer with mingw toolset: .\build --toolset=mingw
    ~ this will create 2 files in folder bin.ntx86 or something similar; copy the files bjam and b2 in the unzipped boost folder;
    ~ now go in boost folder and start build it: .\b2 --toolset=mingw --build-type=complete stage (there is good tutorial to install it along with eclipse : http://theseekersquill.wordpress.com/2010/08/24/howto-boost-mingw/)
    note: this gonna take few hours, so may want to watch a movie or what ever you want to do meanwhile. However you have the option to speed up things a little bit by adding another argument to the build command: -j N, where N is how many cores your processor have.
  • when build has finished, you can now link the library in Qt. To do this you need to modify .pro file. First you'll have to tell Qt where are headers are located, and you do so by adding:
    INCLUDEPATH += path_to_boost_folder, e.g. : INCLUDEPATH += C:/boost_1_54_0
    ~ also if you're using libraries which requires link, for example system and filesystem you have to link them separately:
    LIBS += "C:/boost_1_54_0/stage/lib/libboost_filesystem-mgw48-1_54.a",
    LIBS += "C:/boost_1_54_0/stage/lib/libboost_system-mgw48-1_54.a"
  • after modifying the .pro file, run qmake, then rebuild.

Hope this works for you too!

Update: The folder hierarchy has change. For building the library, one should read the documentation associated with each version and Boost.Build's documentation. Building the library from the root folder is easier (Building Boost 1.52 with MinGW):

C:\boost_1_60_0> bootstrap.bat mingw  
C:\boost_1_60_0> .\b2 --toolset=gcc -j N --build-type=complete
Community
  • 1
  • 1
Athan
  • 777
  • 2
  • 7
  • 21
0

building boost will not put the headers, the headers are for the developer when he creates new code. The installed dirs are the binaries for distribution.

see http://www.boost.org/doc/libs/1_54_0/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary

this will install libraries, that you use at runtime (not compile time). Because you add this bin folder to your path and that is why when runing an app build with boost it will run and not say "could not find xxx.dll"

dzada
  • 5,344
  • 5
  • 29
  • 37