André Prins wrote:
Hi all,
I am having exactly the same problems when trying to link my main-app to a DLL-version of Boost::program_options. (using MSVC 9 and Boost 1.40).
main.obj : 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)
For the first unresolved external, to the options_description::m_default_line_length, there is a workaround, by explicitly specifying a line-length as the second argument when constructing your descriptions. E.g.
po::options_description descriptions( "All options", 80 ); // Note the extra argument 80
main.obj : error LNK2001: unresolved external symbol "class std::basic_string
boost::program_options::arg" (?arg@program_options@boost@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) For the second unresolved external, I could not find a solution and I decided to build a static version of Boost::program_options. This solved both of these two problems.
It would be nice if somebody figure what this problem is and explain this to me. Or provide a patch ;-) - Volodya