Boost Users :
Subject: Re: [Boost-users] Using parse_config_file from program_options
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-10-22 11:42:11
Arthur Carlsson wrote:
> When I try to use the parse_config_file() function from the
> program_options library I get a link error saying (built on OS X 10.5):
> Undefined symbols:
> std::char_traits<char> >&, boost::program_options::options_description
> const&, bool)", referenced from:
> _main in main.cc.o
> ld: symbol(s) not found
> Taking a closer look at the code I discovered that the function is
> declared as a template in boost/program_options/parsers.hpp but is
> defined in boost/libs/program_options/src/parsers.cpp.
> Is this really valid? I've thought that templated functions need to be
> defined along with the declaration as the template arguments need to
> be evaluated at compile time.
> Or am I missing something?
It is legal to define templates in the source files as long as they are
explicitly instantiated, which is what these lines after the definition
const options_description& desc,
As long as you are linking to the program_options library, it should be
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