Date: 2008-08-15 04:53:44
I have had some problems compiling program_options v1.35 on visual C++ 9.0
(2008) Express. It seems that this compiler does not correctly export some
global variables when compiling to DLL, leading to unresolved dependencies.
I have had to make a few changes:
In file options_description.hpp, line 158:
static const unsigned m_default_line_length;
BOOST_STATIC_CONSTANT (unsigned, m_default_line_length = 80);
This is an old fix that I found in the mail archives (2005), seems to have
been erroneously dropped from the base-line.
In file options_description.cpp: removed the declaration of
In file value_semantic.cpp: a singleton variable was defined but not
properly linked by vc9.0. I changed the implementation to (line 17)
static string* str=0;
str = new string;
*str = "arg";
At line 79 (after making the change above), I changed the only use of arg
In file details/value_semantic.hpp: I changed the declaration of the
variable arg to (line 13):
BOOST_PROGRAM_OPTIONS_DECL std::string& arg();
After these changes, program_options links properly, and I was able to run
the demo code.
Please note that also the pre-compiled version of boost 1.35 for the vc9.0
compiler from http://www.boost-consulting.com/download/windows suffers from
these problems: the program_options DLL is unlinkable due to unresolved
references to m_default_line_length and arg.
Evert van de Waal