[resolved] adding boost libraries to paths...?
-
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...
-
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. -
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). -
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.
-
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/includeunix:!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/includeunix:!macx:!symbian: PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/libboost_context.a
@Thanks
-
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/includeunix:!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/includeunix:!macx:!symbian: PRE_TARGETDEPS += $$PWD/../../../../../usr/local/lib/libboost_context.a
@Thanks
-
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