Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-05-12 01:02:25


Hi Stephen,

> Hi all,
>
> I am having a small problem with boost's program options library.
>
> In the documentation it states that to parse a command file you are
> suppose to use the "parse_command_file" function as follows:
>
> parse_config_file("example.cfg", desc)
>
> When attempting this, my compiler (gcc 3.3.3) issues an error stating:
>
> decoder.cpp:61: error: no matching function for call to
> `parse_config_file(
> const char[12], boost::program_options::options_description&)'
>
> It appears that opposed to calling the constructor for basic_istream the
> compiler attempts to find a function with char[12] as the first
> argument. To circumvent this error I can do the follow:
>
> Std::ifstream in( "config.cfg" );
>
> Parse_config_file( in, desc );
>
> And it works. I would rather use the first method opposed to the second
> so is there someway for it to be used instead?

I'm afraid no. The document and the code got out of sync and the code
provides only parse_config_file(istream&, const options_description&).
Since istream does not have any meaningfull constructor, passing string does
not work.

I'll fix this, but this might be post 1.33 due to feature freeze.

- Volodya


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