How to add external libraries to qt4 application c++

user660975 picture user660975 · Mar 15, 2011 · Viewed 14.8k times · Source

what is the best way to add additional compiled libraries to my qt project ? For example boost or poco libs ?

Thanks :)

Answer

Sebastian Dusza picture Sebastian Dusza · Mar 15, 2011

If you're using the GCC compiler add something like this to the .pro file:

For Boost:

INCLUDEPATH += d:/Biblioteki/C++/boost/boost_1_44_0a
LIBPATH     += d:/Biblioteki/C++/boost/boost_1_44_0a/stage/lib
LIBS        += -lboost_system-mgw44-mt-d-1_44
LIBS        += -lboost_filesystem-mgw44-mt-d-1_44
LIBS        += -lboost_date_time-mgw44-mt-d-1_44

For Poco:

INCLUDEPATH += d:/Biblioteki/C++/Poco/poco-1.3.6p2-mingw-qt2/include
LIBPATH     += d:/Biblioteki/C++/Poco/poco-1.3.6p2-mingw-qt2/lib
LIBS        += -lPocoFoundationd
LIBS        += -lPocoNetd
LIBS        += -lPocoUtild
LIBS        += -lPocoXML

INCLUDEPATH - is the location of directory with header files
LIBPATH - is the location of directory with *.a files
LIBS - contains list of libraries you want to use in your application