Opened 14 years ago

Closed 13 years ago

#2506 closed Bugs (fixed)

program_options::arg undefined. Win DLL

Reported by: Patrick White <patbob@…> Owned by: Vladimir Prus
Milestone: Boost 1.38.0 Component: program_options
Version: Boost 1.36.0 Severity: Problem
Keywords: Cc:

Description

In Boost 1.37.0, program_options::arg appears to be undefined in the program_options DLL built for windows. Declared as extern in the boost code, but never defined so ends up being an unresolved at link time.

Must add the following line in my program to work around: BOOST_PROGRAM_OPTIONS_DECL std::string boost::program_options::arg;

FYI, had to define BOOST_ALL_NO_LIB macro to dodge unrelated boost bug (but maybe that cause this?).

Change History (3)

comment:1 by Vladimir Prus, 14 years ago

It is definitely defined, in libs/program_options/value_semantic.cpp:

BOOST_PROGRAM_OPTIONS_DECL std::string arg("arg");

Are you sure you are linking to the right version of the library? E.g. if you're linking to program_options dynamically, then you should define BOOST_PROGRAM_OPTIONS_DYN_LINK when building your own code.

comment:2 by patbob@…, 14 years ago

No, I did not define that undocumented symbol. Defining it fixed things.

That define appears to be undocumented -- that string appears nowhere in any of the html doc files bundled with 1.37.0, and I never saw it while perusing the program options doc files. So, naturally, I didn't know I needed to define it :)

Also fixed defect 1904 (undefined reference to `boost::program_options::options_description::m_default_line_length'), which I was also having problems with.

Go ahead and close this bug -- it's a non-problem once you know about that define.

comment:3 by Vladimir Prus, 13 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.