context.set_main_group(my_option_group); try { context.parse(argc, argv); } catch (Glib::OptionError& e) { cerr << "Error " << e.code() << ": " << e.what() << endl; } if (argc <= 2) { cerr << "Missing filename" << endl; }