Boost logo

Boost Users :

Subject: [Boost-users] undefined reference to boost::filesystem
From: Thibaut Lepage (lepage.boost.user_at_[hidden])
Date: 2012-08-18 13:43:53


Hello,

I can't link against the filesystem library.
When I try to compile a program using boost::filesystem (like the simple
one attached to this email), I get "undefined reference" errors from the
linker:

dourak_at_Vvardenfell:~$ g++ -o dummy dummy.cpp -lboost_filesystem
-lboost_system
/tmp/ccMpl6cj.o: In function
`boost::filesystem::exists(boost::filesystem::path const&)':
dummy.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[boost::filesystem::exists(boost::filesystem::path
const&)]+0x19): undefined reference to
`boost::filesystem::detail::status(boost::filesystem::path const&,
boost::system::error_code*)'
/tmp/ccMpl6cj.o: In function `boost::filesystem::path::path<char*>(char*
const&,
boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<char*>::type>,
void>::type*)':
dummy.cpp:(.text._ZN5boost10filesystem4pathC2IPcEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE[_ZN5boost10filesystem4pathC5IPcEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE]+0x22):
undefined reference to `boost::filesystem::path::codecvt()'
collect2: ld a retourné 1 code d'état d'exécution

I carefully sorted the libraries in the command line, since gcc has trouble
with library dependencies, sometimes, but it still doesn't work.
I use gcc 4.6.3 on Ubuntu 12.04 64bits. The problem occurs either with
boost 1.46.1 (taken from the repositories) or with 1.50.0 (installed with
bjam).

Any hint ?

Thibaut Lepage





Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net