KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am having a problem with command line parsing with boost:program_options. The quickest way to explain it is to show the code so: const std::vector<tstring> args; if (ac > 0 && NULL!=av) //ac is a ULONG { for (int i = 0; i < ac; i++) { args.push_back(av[i]); //av is an LPTSTR pointer (pointer to TCHAR*) } } po::command_line_parser parser(args); The parser ctor is supposed to take a const std::vector<charT> typedef basic_command_line_parser<char> command_line_parser; typedef basic_command_line_parser<wchar_t> wcommand_line_parser; /** Creates instance of 'command_line_parser', passes parameters to it, and returns the result of calling the 'run' method. */ template<class charT> class basic_command_line_parser : private detail::cmdline { public: /** Creates a command line parser for the specified arguments list. The 'args' parameter should not include program name. */ basic_command_line_parser(const std::vector< std::basic_string<charT> >& args); tstring in my program is typedef std::basic_string<TCHAR> tstring; The error I get is: Error 16 error C2664: 'boost::program_options::basic_command_line_parser<charT>::basic_command_line_parser(const std::vector<_Ty> &)' : cannot convert parameter 1 from 'const std::vector<_Ty>' to 'const std::vector<_Ty> &' myfile.cpp 329 Where, oh where, am I going astray? I've tried all kinds of casting and re-defining, but nothing has worked and I'm at the end of my tether. Edit @Zac: Making the changes you suggested... I get the error: Error 14 error C2664: boost::program_options::basic_command_line_parser<charT>::basic_com
Tags (comma-separated)
Save Edits
Cancel