1
GCC 4.7.2 /升压1.58.0问题与升压:: program_options和位置参数
我想要的代码看起来像这样,从实例文档中几乎完全采取:
namespace po = boost::program_options;
po::options_description desc("Allowed options");
desc.add_options()
("help","produce help message")
;
po::positional_options_description pos_desc;
pos_desc.add("input-file",-1);
po::variables_map vm;
// The following line throws an std::logic_error
// what() - error_with_option_name::m_option_style can only be one of
// [0, allow_dash_for_short, allow_slash_for_short, allow_long_disguise
// or allow_long]
po::store(po::command_line_parser(argc,argv).options(desc)
.positional(pos_desc)
.run(),
vm);
...
一个logic_error
例外得到投掷在由注释指示的路线,当我执行的应用程序:
myapp filename1
在没有(位置)参数的情况下运行时显示使用情况。为什么在使用位置命令行参数时抛出?
明天工作将会出现这种情况... –