Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to link statically with Boost libraries in Qt Creator?

How to link statically with Boost libraries in Qt Creator?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 828 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    franc
    wrote on last edited by
    #1

    Hi all. I am doing an application which makes use of Boost libraries.

    I have Boost libraries complied both with the static (.lib) and the dynamic (.dll) versions (1.55).

    My .pro file (should) includes a Boost library statically as follows:

    unix|win32: LIBS += -L$$PWD/'../../../../../Program Files/boost_1_55_0/stage/x86/lib/' -lboost_thread-vc140-mt-gd-1_55
    
    INCLUDEPATH += $$PWD/../../../../../Boost/include/boost-1_55
    DEPENDPATH += $$PWD/../../../../../Boost/include/boost-1_55
    
    win32:!win32-g++: PRE_TARGETDEPS += $$PWD/'../../../../../Program Files/boost_1_55_0/stage/x86/lib/boost_thread-vc140-mt-gd-1_55.lib'
    else:unix|win32-g++: PRE_TARGETDEPS += $$PWD/'../../../../../Program Files/boost_1_55_0/stage/x86/lib/libboost_thread-vc140-mt-gd-1_55.a'
    
    

    The above is an example with Boost thread. The other is Boost system. Everything goes fine, but when it comes to run my executable outside Qt Creator it asks for boost .dlls. How is it possible? When I add those .dll in the directory everything goes fine.

    Note, furthermore, that windeployqt.exe does not load those boost .dll. Adding CONFIG += static or CONFIG += staticlib still does not resolve.

    Qt version: 5.11.1
    OS: Windows 10
    C++ compiler (Qt and Boost): MSVC 2015 x86

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      .lib files on Windows can either be import libraries or static libraries. Are you sure yours are static libraries ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved