gflags库使用

test.cpp

#include <stdio.h>
#include <iostream>
#include "gflags/gflags.h"

DEFINE_string(solver, "",
    "The solver definition protocol buffer text file.");

main(int argc, char** argv)
{
	gflags::ParseCommandLineFlags(&argc, &argv, true);
	printf("hello\n");
	std::cout << FLAGS_solver << std::endl;
	
	return 0;
}

需要先安装gflags库,再编译:g++ test.cpp -lgflags

猜你喜欢

转载自blog.csdn.net/piaopiaopiaopiaopiao/article/details/86520164