undefined reference to `boost::system::get_system_category()
Jump to:
Project: | Programming |
Component: | Code |
Category: | bug report |
Priority: | normal |
Assigned: | Unassigned |
Status: | closed |
Related pages: | #122: Boost :-:-: #128: /tmp/cc6u7EbK.o (.text+0x44): ...undefined reference to foo::bar |
Description
#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations #include // for std::cout int main() { std::cout<<"Hello"; return 0; }
compile:
$ 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
http://www.boost.org/doc/libs/1_43_0/libs/filesystem/doc/index.htm#tutor...
The "2 minute" tutorial is rather buggy.
#125: error: namespace ‘boost::filesystem’ not allowed in using-declaration
Comments
#1
#2
This one is my fault. I am not linking to the proper library.
#3
see:
http://www.network-theory.co.uk/docs/gccintro/gccintro_17.html
#5
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:
http://www.google.com/search?hl=en&q=site:http://www.boost.org/+"boost_filesystem-mt"
#6
Is there an intelligent way to know the name of the library to link to at compile time? (Linux/Kubuntu)
http://stackoverflow.com/questions/3467153/is-there-an-intelligent-way-t...
#7
#129: Boost library does not provide the name of the library to link to
#8
http://ubuntuforums.org/showthread.php?t=897996
http://ubuntuforums.org/showthread.php?t=244593
#9
Automatically closed -- issue fixed for 2 weeks with no activity.