Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [resolved] adding boost libraries to paths...?
Forum Update on Monday, May 27th 2025

[resolved] adding boost libraries to paths...?

Scheduled Pinned Locked Moved Qt Creator and other tools
10 Posts 5 Posters 18.5k 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.
  • M Offline
    M Offline
    mzimmers
    wrote on 22 Nov 2011, 19:05 last edited by
    #1

    I did a search in the forum, but couldn't find an answer.

    I may need to begin using boost. When I installed it, I got this message at the end:
    @ The following directory should be added to compiler include paths:

    /usr/local/boost_1_48_0
    

    The following directory should be added to linker library paths:

    /usr/local/boost_1_48_0/stage/lib@
    

    So...do I need to do something in my Creator preferences/build settings to reflect this, or should these simply be added to Unix environment variables? (And if the latter, can someone tell me which ones?) This is on a Mac, by the way.

    Thanks...

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Hostel
      wrote on 22 Nov 2011, 23:18 last edited by
      #2

      In .pro file you have to add this:
      http://doc.qt.nokia.com/latest/qmake-variable-reference.html#includepath
      @
      INCLUDEPATH += /usr/local/boost_1_48_0
      @
      http://doc.qt.nokia.com/latest/qmake-variable-reference.html#libs
      @
      LIBS += -L/usr/local/boost_1_48_0/stage/lib
      @
      This should work.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mzimmers
        wrote on 22 Nov 2011, 23:27 last edited by
        #3

        Thank you, Hostel. Do you happen to know if there's a way to put those in the preferences, or otherwise automate their inclusion when a new project is created? That would be very convenient.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          Hostel
          wrote on 22 Nov 2011, 23:58 last edited by
          #4

          I don't know how do this but I found something: if you using g++ you could use environment variables:
          http://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
          but then if you will use some lib then you still have to add a option for linker - something like this(SDL example):
          @
          LIBS += -lSDL //flag, not directory because in env is added a directory
          @
          So you can skip from using a INCLUDEPATH in .pro file and a /long/path/directory in LIBS but you have to still use lib flags in LIBS(as above).

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on 23 Nov 2011, 09:12 last edited by
            #5

            What I did, was create my own boost.prf file in <QtDir>/mkspecs/features

            That allows me to just do this in my .pro file:
            @
            CONFIG += boost
            @

            And everything just works.

            The .prf file is basically a part of a .pro file that contains stuff for paths and libraries to link against.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on 24 Nov 2011, 22:20 last edited by
              #6

              [quote author="Andre" date="1322039547"]What I did, was create my own boost.prf file in <QtDir>/mkspecs/features [/quote]

              Do you mind dumping it on the wiki? It could be very handy for our fellow developers.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mzimmers
                wrote on 2 Dec 2011, 01:52 last edited by
                #7

                Andre -

                Exactly what did you put in the boost.prf file?

                And, am I correct in assuming you're talking about your equivalent to this directory on my system?

                Developer/Applications/Qt/Desktop/Qt/474/gcc/mkspecs

                Thanks...

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  Bittoo
                  wrote on 13 Mar 2013, 05:08 last edited by
                  #8

                  Hi
                  Please check this
                  "Adding Libraries to Projects":http:////qt-project.org/doc/qtcreator-2.5/creator-project-creating.html
                  Add BOOST as external liberary to your project. Following line will be added in .pro file of your project. I am using Linux

                  @unix:!macx:!symbian: LIBS += -L$$PWD/../../../../../usr/local/lib/ -lboost_chrono

                  INCLUDEPATH += $$PWD/../../../../../usr/local/include
                  DEPENDPATH += $$PWD/../../../../../usr/local/include

                  unix:!macx:!symbian: PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/libboost_chrono.a

                  unix:!macx:!symbian: LIBS += -L$$PWD/../../../../../usr/local/lib/ -lboost_context

                  INCLUDEPATH += $$PWD/../../../../../usr/local/include
                  DEPENDPATH += $$PWD/../../../../../usr/local/include

                  unix:!macx:!symbian: PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/libboost_context.a
                  @

                  Thanks

                  Regards,
                  Manoj Kumar Panwar,

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    Bittoo
                    wrote on 13 Mar 2013, 05:14 last edited by
                    #9

                    Hi
                    Sorry in the above post the link is wrong
                    Please check this
                    "Adding Libraries to Projects":http://qt-project.org/doc/qtcreator-2.6/creator-project-qmake-libraries.html
                    Add BOOST as external library to your project. Following line will be added in .pro file of your project. I am using Linux

                    @unix:!macx:!symbian: LIBS += -L$$PWD/../../../../../usr/local/lib/ -lboost_chrono

                    INCLUDEPATH += $$PWD/../../../../../usr/local/include
                    DEPENDPATH += $$PWD/../../../../../usr/local/include

                    unix:!macx:!symbian: PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/libboost_chrono.a

                    unix:!macx:!symbian: LIBS += -L$$PWD/../../../../../usr/local/lib/ -lboost_context

                    INCLUDEPATH += $$PWD/../../../../../usr/local/include
                    DEPENDPATH += $$PWD/../../../../../usr/local/include

                    unix:!macx:!symbian: PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/libboost_context.a
                    @

                    Thanks

                    Regards,
                    Manoj Kumar Panwar,

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      Bittoo
                      wrote on 13 Mar 2013, 05:43 last edited by
                      #10

                      Hi
                      I have downloaded example files from this link
                      "example Days Alive: qtBoostExample.zip":http://cpp-qt-mac-win.blogspot.in/2011/10/qt-boost-for-beginners-step-by-step.html
                      And add the external lib as
                      @unix:!macx:!symbian: LIBS += -L$$PWD/../../../../../usr/local/lib/ -lboost_date_time
                      INCLUDEPATH += $$PWD/../../../../../usr/local/include
                      DEPENDPATH += $$PWD/../../../../../usr/local/include
                      unix:!macx:!symbian: PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/libboost_date_time.a@
                      Its working fine
                      Thanks
                      Manoj

                      Regards,
                      Manoj Kumar Panwar,

                      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