
Hello Ovanes, thanks for the reply. I fixed it. I eventually found your posting and tried your suggestion attributing boost::program_options::arg with an additional __declspec(selectany) but either I did something wrong or things are different with msvc-8.0 it did not work for me. Instead I went down a different path and got rid of the global arg variable altogether. Since nothing seems to write into it and the value is always copied it seemed like a reasonable thing to do considering it causes so much grief with the linking. Once this was fixed I got another linker error: error LNK2001: unresolved external symbol "public: static unsigned int const boost::program_options::options_description::m_default_line_length" (?m_default_line_length@options_description@program_options@boost@@2IB) I found the solution to that one from this posting from Evert at http://archives.free.net.ph/message/20080815.085344.d72efb54.en.html . Once I changed the declaration of the class static const m_default_line_length to: BOOST_STATIC_CONSTANT (unsigned, m_default_line_length = 80); With these two changes in place all compiled and linked without a problem. Below I've inlined the patch of my changes against the original boost_1_36_0 source as reference for other people running into this issue. If these changes seem like a good idea to others perhaps they could be included with the next boost release. Regards, Sebastian diff -ru -x '*~' boost_1_36_0_src_orig/boost/program_options/detail/value_semantic.hpp boost_1_36_0_src/boost/program_options/detail/value_semantic.hpp --- boost_1_36_0_src_orig/boost/program_options/detail/value_semantic.hpp 2007-11-25 13:07:19.000000000 -0500 +++ boost_1_36_0_src/boost/program_options/detail/value_semantic.hpp 2008-09-17 12:36:20.447677200 -0400 @@ -10,12 +10,11 @@ namespace boost { namespace program_options { - extern BOOST_PROGRAM_OPTIONS_DECL std::string arg; - template<class T, class charT> std::string typed_value<T, charT>::name() const { + static std::string arg("arg"); if (!m_implicit_value.empty() && !m_implicit_value_as_text.empty()) { std::string msg = "[=arg(=" + m_implicit_value_as_text + ")]"; if (!m_default_value.empty() && !m_default_value_as_text.empty()) diff -ru -x '*~' boost_1_36_0_src_orig/boost/program_options/options_description.hpp boost_1_36_0_src/boost/program_options/options_description.hpp --- boost_1_36_0_src_orig/boost/program_options/options_description.hpp 2007-11-25 13:07:19.000000000 -0500 +++ boost_1_36_0_src/boost/program_options/options_description.hpp 2008-09-17 12:35:37.306223900 -0400 @@ -155,8 +155,8 @@ */ class BOOST_PROGRAM_OPTIONS_DECL options_description { public: - static const unsigned m_default_line_length; - + BOOST_STATIC_CONSTANT (unsigned, m_default_line_length = 80); + /** Creates the instance. */ options_description(unsigned line_length = m_default_line_length); /** Creates the instance. The 'caption' parameter gives the name of diff -ru -x '*~' boost_1_36_0_src_orig/libs/program_options/src/options_description.cpp boost_1_36_0_src/libs/program_options/src/options_description.cpp --- boost_1_36_0_src_orig/libs/program_options/src/options_description.cpp 2007-11-25 13:38:02.000000000 -0500 +++ boost_1_36_0_src/libs/program_options/src/options_description.cpp 2008-09-17 13:07:03.748692900 -0400 @@ -201,8 +201,6 @@ return *this; } - const unsigned options_description::m_default_line_length = 80; - options_description::options_description(unsigned line_length) : m_line_length(line_length) {} diff -ru -x '*~' boost_1_36_0_src_orig/libs/program_options/src/value_semantic.cpp boost_1_36_0_src/libs/program_options/src/value_semantic.cpp --- boost_1_36_0_src_orig/libs/program_options/src/value_semantic.cpp 2007-11-25 13:38:02.000000000 -0500 +++ boost_1_36_0_src/libs/program_options/src/value_semantic.cpp 2008-09-17 12:40:16.983468600 -0400 @@ -64,12 +64,10 @@ } #endif - BOOST_PROGRAM_OPTIONS_DECL std::string arg("arg"); - std::string untyped_value::name() const { - return arg; + return "arg"; } unsigned