Skip to Content

undefined reference to `boost::system::get_system_category()

warning: Creating default object from empty value in /home/gnostic_augustin/modules/project_issue-6/includes/ on line 20.
Category:bug report
Related pages:#122: Boost libraries :-:-: #128: /tmp/cc6u7EbK.o (.text+0x44): ...undefined reference to foo::bar
#include "boost/filesystem.hpp"   // includes all needed Boost.Filesystem declarations
#include                // for std::cout

int main()
        return 0;


$ g++ boost_example.cpp -o run
/tmp/cc6u7EbK.o: In function `__static_initialization_and_destruction_0(int, int)':
boost_example.cpp:(.text+0x38): undefined reference to `boost::system::get_system_category()'
boost_example.cpp:(.text+0x44): undefined reference to `boost::system::get_generic_category()'
boost_example.cpp:(.text+0x50): undefined reference to `boost::system::get_generic_category()'
boost_example.cpp:(.text+0x5c): undefined reference to `boost::system::get_generic_category()'
boost_example.cpp:(.text+0x68): undefined reference to `boost::system::get_system_category()'
collect2: ld returned 1 exit status

The "2 minute" tutorial is rather buggy.
#125: error: namespace ‘boost::filesystem’ not allowed in using-declaration



Title:ndefined reference to `boost::system::get_system_category()» undefined reference to `boost::system::get_system_category()


Related pages:-122: Boost libraries

This one is my fault. I am not linking to the proper library.



Yeah, but how to find which is the proper library??

I managed to get it to compile with the following, but it involved a lot of (intelligent) guess work:

g++ boost_example.cpp -o run -lboost_filesystem-mt

The problem is that nowhere it is said what the name of the library is:"boost_filesystem-mt"


Is there an intelligent way to know the name of the library to link to at compile time? (Linux/Kubuntu)



Status:fixed» closed
Related pages:-122: Boost libraries, -128: /tmp/cc6u7EbK.o (.text+0x44): ...undefined reference to foo::bar

Automatically closed -- issue fixed for 2 weeks with no activity.

Dr. Radut | project_issue