#include #include #include #include #include using namespace std; void usage(const char * progname) { cout << "Usage: " << progname << " [options] " << endl; cout << " Options:" << endl; cout << " -o|--output-file " << endl; cout << " -w|--width " << endl; cout << " -h|--height " << endl; cout << " -m|--multisample " << endl; cout << " -v|--verbose" << endl; exit(42); } int main(int argc, char * argv[]) { int opt; int option_index; static const struct option long_options[] = { { "output-file", required_argument, NULL, 'o' }, { "width", required_argument, NULL, 'w' }, { "height", required_argument, NULL, 'h' }, { "multisample", required_argument, NULL, 'm' }, { "verbose", no_argument, NULL, 'v' }, { NULL, 0, NULL, 0 } }; while ((opt = getopt_long(argc, argv, "o:w:h:m:", long_options, &option_index)) != -1) { switch (opt) { case 'o': break; case 'w': break; case 'h': break; case 'm': break; case 'v': break; default: usage(argv[0]); } } if (optind >= argc) { usage(argv[0]); } cout << "hi" << endl; }