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;
}
}