Boost logo

Boost :

Subject: Re: [boost] [Filesystem] Linking problem with 1_46_1
From: Max Moorkamp (mmoorkamp_at_[hidden])
Date: 2011-04-05 04:51:11


> Max Moorkamp wrote:
>> > Hi,
>> >
>> > I have recently upgraded to boost 1_46_1 and since then I am
>> > experience linking problems with the filesystem library.
>> >
>> > I have performed a standard install using ./bootstrap.sh; bjam; bjam
>> > install under Ubuntu 10.04 with the default gcc (4.4.3).
>> > I can boil the problem down to this test program:
>> >
>> > #include<boost/filesystem.hpp>
>> > #define BOOST_FILESYSTEM_VERSION 3
>> > #define BOOST_FILESYSTEM_NO_DEPRECATED
>> >
>> > int main()
>> > {
>> > boost::filesystem::copy_file("a", "b");
>> > }
>> >
>> > compiling this with
>> >
>> > g++ test.cpp -lboost_system -lboost_filesystem
>> >
> It might be as simple as the order you link to the libraries. The boost
> filesystem library depends on the boost system library, so you should
> probably put "-lboost_system" after "-lboost_filesystem" on the command
> line to link your program.
That was my first thought, but the linking error does not come from
boost_system, plus all of

g++ test.cpp -lboost_filesystem -lboost_system
g++ test.cpp -lboost_system -lboost_filesystem
g++ test.cpp -lboost_filesystem

give the same
/tmp/cc9OO6P2.o: In function
`boost::filesystem3::copy_file(boost::filesystem3::path const&,
boost::filesystem3::path const&)':
test.cpp:(.text._ZN5boost11filesystem39copy_fileERKNS0_4pathES3_[boost::filesystem3::copy_file(boost::filesystem3::path
const&, boost::filesystem3::path const&)]+0x2a): undefined reference to
`boost::filesystem3::detail::copy_file(boost::filesystem3::path const&,
boost::filesystem3::path const&,
boost::filesystem3::copy_option::enum_t, boost::system::error_code*)'
collect2: ld returned 1 exit status

Regards

Max

-- 
Max Moorkamp
IFM-GEOMAR
Wischhofstr. 1-3
24148 Kiel
Tel.: Germany - 431 - 600 2570
FAX.: Germany - 431 - 600 2915

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk