#include <iostream>
#include <gflags/gflags.h>
DEFINE_bool(verbose, false, "Enable verbose logging");
DEFINE_int32(port, 8080, "Port number to listen on");
DEFINE_double(threshold, 0.5, "Threshold value");
DEFINE_string(config, "app.cfg", "Configuration file");
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
std::cout << "Verbose: " << (FLAGS_verbose ? "yes" : "no") << "\n";
std::cout << "Port: " << FLAGS_port << "\n";
std::cout << "Threshold: " << FLAGS_threshold << "\n";
std::cout << "Config: " << FLAGS_config << "\n";
}
gflags
2025-09-10
本文总共 589 字
· 阅读全文大约需要 2 分钟