I want to
use the program-options library, and the copy of boost used by this application
suite is 1.38. Using Visual Studio 2008, debug build, the resulting
program crashes in the variables_map constructor.
My
assumption is that the compiler options don’t match: in particular,
a stupid thing called
_HAS_ITERATOR_DEBUGGING=0
is
infectious as it causes the STL to generate different code and different sized
objects.
The layout
of the boost files doesn’t match the documentation, in that bjam.exe is
in a subdirectory, and there is no such thing as bootstrap. Anyway, I
try:
D:\boost_1_38_0>
bin\bjam link=static threading=multi variant=debug toolset=msvc-9.0 --define=_HAS_ITERATOR_DEBUGGING=0
Libs\program_options\build
and it
indeed makes a file with the same name as the one my program is linking to: libboost_program_options-vc90-mt-gd-1_38.lib,
which I copy over the original.
It made no
difference.
I don’t
think that’s the specific problem, though, since it crashes on the
constructor, not on some later usage from a different translation unit.
The call
tree is:
foo.exe!std::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,boost::program_options::variable_value,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>
>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const ,boost::program_options::variable_value> >,0> >::_Init()
Line 1180 + 0xe bytes
foo.exe!std::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,boost::program_options::variable_value,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const ,boost::program_options::variable_value> >,0>
>::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,boost::program_options::variable_value,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>
>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const ,boost::program_options::variable_value> >,0> >(const
std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > & _Parg=less, const
std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const ,boost::program_options::variable_value> > &
_Al={...}) Line 511
foo.exe!std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,boost::program_options::variable_value,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const ,boost::program_options::variable_value> >
>::map<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,boost::program_options::variable_value,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>
>,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const ,boost::program_options::variable_value> > >() Line
104
foo.exe!boost::program_options::variables_map::variables_map()
Line 172 + 0x40 bytes
foo.exe!main(int
argc=1, char * * argv=0x01f84190) Line 179 + 0xb bytes