0

I'm a bit new to libraries and using anything other than Visual Studios to write C++. I was hoping to get help with installing Boost 1_49_0 for use with Qt Creator 4.8.1 on my Windows 7 computer.

Edit: I need specific instructions on how libraries are added within Qt Creator. When I try to add library and go to eternal library, why does is only show the libraries with a .lib extension and not the ones with a .a extension?

trippedoutfish
  • 357
  • 1
  • 4
  • 8

1 Answers1

0

Can't see any problems. Just download boost development libraries, add the include paths to your Qt project, tell linker what libraries to use, and you're done.

Have a look at Adding Libraries to Projects from Qt documentation.

Andrejs Cainikovs
  • 27,428
  • 2
  • 75
  • 95
  • The problem I'm having is that I'm apparently too dense to even understand that tutorial. When I try to include boost I can only include one .lib file and I need to include a folder of .lib files and also have a bunch of other files also. I added a screenshot to try and make my point more clear (since I'm not really sure what other information I can provide you). [Picture](http://i.imgur.com/6RpxY.png) – trippedoutfish May 31 '12 at 23:21
  • First of all, you don't need add a folder of all the lib files. If you use boost regex, add only boost regex. Secondly, `.lib` files are for MS Visual Studio, while you need to download boost for MinGW, since Qt uses MinGW compiler. – Andrejs Cainikovs May 31 '12 at 23:33
  • Would I follow a guide like [this?](http://ascend4.org/Binary_installer_for_Boost_on_MinGW) – trippedoutfish Jun 01 '12 at 00:00
  • Sure, you could just use that installer to install boost built for MinGW, it should work. Ignore second section about building boost by yourself. – Andrejs Cainikovs Jun 01 '12 at 08:33
  • So I used that to install boost for MinGW and now I try to link to an external library. I put the include file as "C:\Program Files (x86)\Boost-1.41.0\include" and the lib file I could only guess would be "C:\Program Files (x86)\Boost-1.41.0\lib\libboost_regex-mgw34-mt.lib" But you said that .lib files are only for MSVS. – trippedoutfish Jun 01 '12 at 16:17
  • This is what my .pro file added win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../Program Files (x86)/Boost-1.41.0/lib/ -llibboost_regex-mgw34-mt else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../Program Files (x86)/Boost-1.41.0/lib/ -llibboost_regex-mgw34-mtd INCLUDEPATH += $$PWD/../../../../../../Program Files (x86)/Boost-1.41.0/include/boost-1_41/boost DEPENDPATH += $$PWD/../../../../../../Program Files (x86)/Boost-1.41.0/include/boost-1_41/boost It's giving me an error when I try to #include – trippedoutfish Jun 01 '12 at 16:18
  • MinGW libraries has `.a` extension, not lib. Secondly, when you specify libraries to GCC based linkers, you should drop *lib* prefix. Have a look here: http://stackoverflow.com/questions/8278348/cannot-link-against-boost-filesystem-in-qt – Andrejs Cainikovs Jun 01 '12 at 21:30
  • So I should not be trying to right click and adding library? When I do it only finds the .lib files and not my .a files. I tried this like what you linked `INCLUDEPATH += C:/boost_1_49_0 LIBS += -LC:/boost_1_49_0/stage/lib -llibboost_regex-mgw46-mt-1_49` And it still does not find /boost/regex.hpp – – trippedoutfish Jun 04 '12 at 22:35