Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem linking boost filesystem 1_36_0 on ubuntu gcc 4.2
From: SkiltZ (julien.noblet_at_[hidden])
Date: 2008-11-29 21:55:28


Have you try using those g++ option:
 -lboost_filesystem

ex:
g++ -DHAVE_CONFIG_H -I. -I/home/.../Projects/myProject/src -I.. -O0 -g3
-lboost_program_options -lboost_filesystem -MT options.o -MD -MP -MF
.deps/mysrc.Tpo -c -o options.o /home/.../Projects/myProject/src/mysrc.cpp

With this option I could link my program ;)

Best Regards.
SkiltZ

Kevin Stevens-4 wrote:
>
> Answering my own question. Hopefully someone can google this error in the
> future and fix it a lot quicker than the several hours it took me....
>
> The problem was that I was not correctly specifying the include headers. I
> had entered -I/path/to/boost_1_36_0/boost not -I/path/to/boost_1_36_0. I
> thought I had that path right because everything was compiling. What I did
> not take into account was that boost 1_34_1 was installed via the package
> manager by the administrator of the system so the include files were
> automatically being picked up despite me not explicitly specifying them.
> The interfaces I was using did not change, but the underlying code did,
> hence my code still compiled, but refused to link and unfortunately spit
> out misleading errors.
>
>
> -K
>
> From: Kevin Stevens
> Sent: Thursday, October 30, 2008 5:15 PM
> To: 'boost-users_at_[hidden]'
> Subject: Problem linking boost filesystem 1_36_0 on ubuntu gcc 4.2
>
> Hello, when I am trying to link boost::filesystem into my program I am
> receiving link errors. I am trying to convert from boost 1_34_1 to
> 1_36_0- previously this built against 1_34_1 without any issue.
>
>
> When I link I get the following error:
> /home/kstevens/code/CrossingEngine/../lib/libtypes.a(Config_Constants.o):
> In function
> `boost::enable_if<boost::filesystem::is_basic_path<boost::filesystem::basic_path<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,
> boost::filesystem::path_traits> >, bool>::type
> boost::filesystem::exists<boost::filesystem::basic_path<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,
> boost::filesystem::path_traits>
> >(boost::filesystem::basic_path<std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,
> boost::filesystem::path_traits> const&)':
> /usr/include/boost/filesystem/operations.hpp:279: undefined reference to
> `boost::filesystem::detail::status_api(std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > const&, int&)'
>
>
> I did an objdump -CT on libboost_filesystem-gcc42-mt-1_36.so and got the
> following two functions as output but not the one the linker appears to be
> looking for:
> 000000000000c4e0 g DF .text 00000000000000e3 Base
> boost::filesystem::detail::status_api(std::string const&,
> boost::system::error_code&)
> 000000000000c720 g DF .text 00000000000000e3 Base
> boost::filesystem::detail::symlink_status_api(std::string const&,
> boost::system::error_code&)
>
>
> Could this be a bad build? Am I missing something- perhaps I need to link
> another file in? I built 1_36_0 myself using a default configuration other
> than telling it where to put the output libs. I have ensured that I am
> linking against and including headers from 1_36_0, and have also made a
> clean build. Is there anything else I should try?
>
> Thank you,
> -Kevin
>
>
> This is my code snippet that uses boost::filesystem:
>
> //Create Directory if it does not already exist.
> if(!boost::filesystem::exists(reportFilePath))
> {
> cout << "output path: " << reportFilePath << " did not exist,
> which may indicate a different configuration than was intended, creating
> directory now." << endl;
> try
> {
> boost::filesystem::path path(reportFilePath);
> boost::filesystem::create_directory(path);
> }
> catch(boost::filesystem::filesystem_error e)
> {
> cout << "Error: " << e.what() << endl;
> }
>
> }
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
View this message in context: http://www.nabble.com/Problem-linking-boost-filesystem-1_36_0-on-ubuntu-gcc-4.2-tp20258473p20753538.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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