(C++) Linking against a library in Qt Creator under Ubuntu

February 24, 2017 · View on GitHub

 

 

 

 

 

(C++) Linking against a library in Qt Creator under Ubuntu

 

Qt CreatorUbuntu

 

Qt Creator FAQ showing how to linking against a library in Qt Creator under Ubuntu.

 

In the Qt Creator project file, add the following line, to link against the Boost.Regex library:

 


LIBS += -L/usr/lib -lboost_regex #Or perhaps one of these: #LIBS += -L/usr/local/lib -lboost_regex #LIBS += -lboost_regex

 

Note that this example assumes that a file called 'libboost.a' or 'libboost.so' (I do not know where it exactly links against) exists in the /usr/lib folder (if not, you can easily install Boost from the Ubuntu Software Center).

 

The Hello Boost program shows how to link against the Boost library Boost.Regex under both Ubuntu and Windows:

 


unix:LIBS += -L/usr/lib -lboost_regex win32:LIBS+=C:/Qt/2010.02.1/qt/lib/libboost_regex.lib