1
我有以下代碼;boost :: any_cast拋出程序選項C++
using namespace std;
using namespace boost::program_options;
using namespace boost::filesystem;
using namespace cv;
namespace fs = boost::filesystem;
int frames2skip;
options_description desc("Allowed options");
desc.add_options();
("frames2skip", value<int>(&frames2skip)->default_value(2));
variables_map opts;
store(parse_command_line(argc, argv, desc), opts);
frames2skip = opts["frames2skip"].as<int>();
我會在最後一行分配'frames2skip'
後後出現以下錯誤:
what(): boost::bad_any_cast: failed conversion using boost::any_cast
Aborted (core dumped)
什麼是錯的,我怎麼能解決這個問題?
尤里,你能更簡單地解釋一下你的意思嗎? – yusuf
@yusuf什麼不清楚?刪除指定的分號來修復你的東西。 –