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. Using Boost With QtCreator?
Forum Updated to NodeBB v4.3 + New Features

Using Boost With QtCreator?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.8k Views 1 Watching
  • 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.
  • G Offline
    G Offline
    Galvanic_Cell
    wrote on 27 Nov 2015, 03:01 last edited by
    #1

    I have been able to use <boost/filesystem> in Visual studio no problem but have had trouble getting it to work in QtCreator.

    I first tried putting in my .Pro file

    INCLUDEPATH += C:\boost\include\boost-1_59
    LIBS += "-LC:\boost\boost_1_59_0\stage\lib"

    and get error
    C:\boost\include\boost-1_59\boost\system\error_code.hpp:221: error: undefined reference to `boost::system::generic_category()'

    C:\boost\include\boost-1_59\boost\system\error_code.hpp:222: error: undefined reference to `boost::system::generic_category()'

    C:\boost\include\boost-1_59\boost\system\error_code.hpp:223: error: undefined reference to `boost::system::system_category()'
    collect2.exe:-1: error: error: ld returned 1 exit status

    I looked around online and found some mention of problems like this but still couldn't get it to work.

    I tried changing the .pro file to have

    INCLUDEPATH += C:\boost\include\boost-1_59
    LIBS += "-LC:\boost\boost_1_59_0\stage\lib" -llibboost_filesystem-vc140-mt-1_59

    And still get the same errors

    Any help is appreciated

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 27 Nov 2015, 06:40 last edited by
      #2

      You should not use the "lib" prefix and the version string is probably not needed as well (but try with that string if it doesn't work without), so it should be:
      LIBS += "-LC:\boost\boost_1_59_0\stage\lib" -lboost_filesystem

      One more thing to consider: Boost libraries must be built using the same compiler you use to build your project!

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      G 1 Reply Last reply 26 Dec 2015, 13:21
      0
      • J jsulm
        27 Nov 2015, 06:40

        You should not use the "lib" prefix and the version string is probably not needed as well (but try with that string if it doesn't work without), so it should be:
        LIBS += "-LC:\boost\boost_1_59_0\stage\lib" -lboost_filesystem

        One more thing to consider: Boost libraries must be built using the same compiler you use to build your project!

        G Offline
        G Offline
        Galvanic_Cell
        wrote on 26 Dec 2015, 13:21 last edited by
        #3

        @jsulm
        So think I got it figured out. I went back and recompiled the libraries with MSVC 2010 which is what I am using with Qt.

        now my pro file looks like

        INCLUDEPATH += C:\boost\boost_1_59_0\boost-dir\include
        LIBS += -L"C:\boost\boost_1_59_0\boost-dir\lib" -lboost_filesystem-vc100-mt-1_59
        

        which builds fine. Posting this for future people stumbling down the same path.

        1 Reply Last reply
        0

        • Login

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