(C++) Undefined reference to 'boost::system::get\system\category()' (using Qt Creator)
January 11, 2018 · View on GitHub
(C++) 


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
Operating system(s) or programming environment(s)
Ubuntu 10.04 (lucid)
Qt Creator 2.0.0
- G++ 4.4.5
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