Boost logo

Boost Users :

Subject: Re: [Boost-users] msvc fail to link with dynamic boost_program_options library
From: André Prins (a.h.prins_at_[hidden])
Date: 2009-10-08 05:42:31


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_at_options_description_at_program_options_at_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<char,struct std::char_traits<char>,class
> std::allocator<char> > boost::program_options::arg"
> (?arg_at_program_options_at_boost@@3V?$basic_string_at_DU?$char_traits_at_D@std@@V?$allocator_at_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.

Regards,
André


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net