#include using namespace std; #include namespace po = boost::program_options; int main(int argc, char **argv) { po::options_description desc("Options"); desc.add_options() ("help", "this help screen") ("foo-1", po::value(), "foo") ("bar-2", po::value(), "bar") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); if (vm.count("help")) { cout << desc << "\n"; return 0; } cout << "count(foo-1)=" << vm.count("foo-1") << '\n' << "count(1)=" << vm.count("1") << '\n' << "count(bar-2)=" << vm.count("bar-2") << '\n'; return 0; }