<div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 25, 2012 at 5:48 PM, Andrew E Slaughter <span dir="ltr">&lt;<a href="mailto:andrew.e.slaughter@gmail.com" target="_blank">andrew.e.slaughter@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I am attempting to parse configuration options from a file using Boost::program_options. I am following the example provided on the website (<a href="http://www.boost.org/doc/libs/1_49_0/doc/html/program_options/overview.html#id2501135" target="_blank">http://www.boost.org/doc/<u></u>libs/1_49_0/doc/html/program_<u></u>options/overview.html#<u></u>id2501135</a>):<br>

<br>
variables_map vm;<br>
store(parse_command_line(argc, argv, desc), vm);<br>
store(parse_config_file(&quot;<u></u>example.cfg&quot;, desc), vm);<br>
notify(vm);<br>
<br>
I have included the following related to program_options:<br>
#include &lt;boost/program_options.hpp&gt; // Boost Program Options<br>
#include &lt;boost/program_options/<u></u>positional_options.hpp&gt;<br>
#include &lt;boost/program_options/<u></u>parsers.hpp&gt;<br>
<br>
I have the exact code as above in my program but receive the following error. The program works fine if I comment out the line with the parse_config_file line. Can someone please help me get this working.<br>
<br>
Thanks,<br>
Andrew<br>
<br>
--- COMPILER ERROR --------------------------<br>
/home/slaughter/Documents/<u></u>programs/source/common/user_<u></u>options/user_options.cpp: In member function ‘void SlaughterCommon::User_options:<u></u>:apply_options(int, char**)’:<br>
/home/slaughter/Documents/<u></u>programs/source/common/user_<u></u>options/user_options.cpp:27:<u></u>76: error: no matching function for call to ‘parse_config_file(const char [22], boost::program_options::<u></u>options_description&amp;, bool)’<br>

/home/slaughter/Documents/<u></u>programs/source/common/user_<u></u>options/user_options.cpp:27:<u></u>76: note: candidates are:<br>
/usr/include/boost/program_<u></u>options/parsers.hpp:163:5: note: template&lt;class charT&gt; boost::program_options::basic_<u></u>parsed_options&lt;charT&gt; boost::program_options::parse_<u></u>config_file(std::basic_<u></u>istream&lt;charT&gt;&amp;, const boost::program_options::<u></u>options_description&amp;, bool)<br>

/usr/include/boost/program_<u></u>options/parsers.hpp:176:5: note: template&lt;class charT&gt; boost::program_options::basic_<u></u>parsed_options&lt;charT&gt; boost::program_options::parse_<u></u>config_file(const char*, const boost::program_options::<u></u>options_description&amp;, bool)<br>
</blockquote><div>[...snip...] <br></div><div><br>So this overload looks like the one you want, but it has a non-deduced template parameter charT (which should probably be deduced to be char? I&#39;m not sure). I got the short program below to compile by explicitly specifying the charT template parameter as char.<br>
<br>#include &lt;boost/program_options.hpp&gt;<br><br>int main(int argc, char* argv[])<br>{<br>    using namespace boost::program_options;<br>    options_description desc;<br>    variables_map vm;<br>    store(parse_command_line(argc, argv, desc), vm);<br>
    store(parse_config_file&lt; char &gt;(&quot;example.cfg&quot;, desc), vm);<br>    notify(vm);<br>    return 0;<br>}<br><br>Please file a trac ticket alerting the Boost.ProgramOptions maintainer of the compiler failure of the example snippet in the docs.<br>
<br>HTH,<br><br>- Jeff<br><br></div></div></div>

