You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
627 B

  1. #include <iostream>
  2. #include <gflags/gflags.h>
  3. DEFINE_string(input, "", "Input file to process.");
  4. DEFINE_int32(num_threads, 1, "Number of threads to use.");
  5. int main(int argc, char* argv[]) {
  6. // 初始化gflags库
  7. gflags::ParseCommandLineFlags(&argc, &argv, true);
  8. // 检查是否提供了输入文件
  9. if (FLAGS_input.empty()) {
  10. std::cerr << "Error: Input file not specified." << std::endl;
  11. return 1;
  12. }
  13. // 输出解析到的参数
  14. std::cout << "Input file: " << FLAGS_input << std::endl;
  15. std::cout << "Number of threads: " << FLAGS_num_threads << std::endl;
  16. return 0;
  17. }