Subject: Re: [boost] [filesystem][iostreams][program_options] linker issues on msvc
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2009-11-30 02:31:12
Vladimir Prus wrote:
> Alexander Arhipenko wrote:
>> The reason is:
>> #include <boost/filesystem.hpp> --> includes <boost/path.hpp> -->
>> includes <boost/system/system_error.hpp> --> includes
>> File boost/system/error_code.hpp has following declarations:
>> BOOST_SYSTEM_DECL const error_category & get_system_category();
>> BOOST_SYSTEM_DECL const error_category & get_generic_category();
>> So, when the header above is included in main.cpp, BOOST_SYSTEM_DECL unrolls to:
>> And this causes the linker error.
>> As a result, library that links boost::filesystem should link boost::system.
> Yes, and this:
> lib boost_filesystem
> should be enough for that. I'll check why is that not working.
I've looked. Apparently, Boost.Filesystem not only uses Boost.System in its
sources, but also uses it in inlined and/or template functions. Therefore, a
client of Boost.Filesystem will have direct references to Boost.System function
in it. And on Windows, for this to work, Boost.System library must be directly
I've checked in a patch that adds necessary usage requirements to Boost.Filesystem,
Thanks for the report!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk