Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) BoostQtQt CreatorUbuntu Undefined reference to 'boost::system::get_system_category()' (using Qt Creator)

 

link error (BEI 5).

 

One of the versions of Undefined reference to 'boost::system::get_system_category()', encountered when using Qt Creator.

 

 

 

 

Full error message

 

/MyFolder/main.o:: In function '__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:205: error: undefined reference to 'boost::system::get_system_category()'
/usr/include/boost/system/error_code.hpp:206: error: undefined reference to 'boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:211: error: undefined reference to 'boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:212: error: undefined reference to 'boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:213: error: undefined reference to 'boost::system::get_system_category()'
:: error: collect2: ld returned 1 exit status

 

 

 

 

 

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file

 

#-------------------------------------------------
#
# Project created by QtCreator 2010-08-02T13:45:48
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = CppFile
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

 

 

 

 

 

Source code

 

If you want to work with Boost.Asio:

 

#include <boost/asio.hpp>

 

Or if you want to work with Boost.Filesystem:

 

#include <boost/filesystem.hpp>

 

 

 

 

 

Solution

 

Add the following line to the Qt project file:

 

LIBS += -lboost_system

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict