On Wed, Apr 25, 2012 at 5:48 PM, Andrew E Slaughter < andrew.e.slaughter@gmail.com> wrote:
Hello,
I am attempting to parse configuration options from a file using Boost::program_options. I am following the example provided on the website ( http://www.boost.org/doc/**libs/1_49_0/doc/html/program_** options/overview.html#**id2501135http://www.boost.org/doc/libs/1_49_0/doc/html/program_options/overview.html#... ):
variables_map vm; store(parse_command_line(argc, argv, desc), vm); store(parse_config_file("**example.cfg", desc), vm); notify(vm);
I have included the following related to program_options: #include
// Boost Program Options #include #include 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.
Thanks, Andrew
--- COMPILER ERROR -------------------------- /home/slaughter/Documents/**programs/source/common/user_**options/user_options.cpp: In member function ‘void SlaughterCommon::User_options:**:apply_options(int, char**)’: /home/slaughter/Documents/**programs/source/common/user_** options/user_options.cpp:27:**76: error: no matching function for call to ‘parse_config_file(const char [22], boost::program_options::**options_description&, bool)’ /home/slaughter/Documents/**programs/source/common/user_** options/user_options.cpp:27:**76: note: candidates are: /usr/include/boost/program_**options/parsers.hpp:163:5: note: template<class charT> boost::program_options::basic_**parsed_options<charT> boost::program_options::parse_**config_file(std::basic_**istream<charT>&, const boost::program_options::**options_description&, bool) /usr/include/boost/program_**options/parsers.hpp:176:5: note: template<class charT> boost::program_options::basic_**parsed_options<charT> boost::program_options::parse_**config_file(const char*, const boost::program_options::**options_description&, bool)
[...snip...]
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'm
not sure). I got the short program below to compile by explicitly
specifying the charT template parameter as char.
#include