Boost logo

Boost Users :

Subject: Re: [Boost-users] Using parse_config_file from program_options
From: Arthur Carlsson (arthur_at_[hidden])
Date: 2008-10-23 01:40:50


Hi!
There must be something else I'm missing then. I'm linking the
program_options library in and everything else works great, it's just that
one function that doesn't link.Oh, and I'm using Boost 1.35.0, gcc 4.0.1 and
cmake.
I'll take a closer look. Thanks!

Regards.
Arthur

On Wed, Oct 22, 2008 at 17:42, Steven Watanabe <watanabesj_at_[hidden]> wrote:

> AMDG
>
>
> 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:
>> "boost::program_options::basic_parsed_options<char>
>> boost::program_options::parse_config_file<char>(std::basic_istream<char,
>> 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 are
> for
>
> template
> BOOST_PROGRAM_OPTIONS_DECL basic_parsed_options<char>
> parse_config_file(std::basic_istream<char>& is,
> const options_description& desc,
> bool allow_unregistered);
>
> As long as you are linking to the program_options library, it should be
> fine.
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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