cpp boost

作者: hehehehe | 来源:发表于2020-09-22 18:15 被阅读0次
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>

namespace po = boost::program_options;
namespace fs = boost::filesystem;
namespace logging = boost::log;

po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);

 bool argumentError = false;
if (!vm.count("input")) {
      std::cerr << "Input file is mandatory." << std::endl;
      argumentError = true;
      if (!fs::exists(inputFile)) {
          std::cerr << "The input file does not exist." << std::endl;
          argumentError = true;
      }
}

CMakeLists.txt

# Boost
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC ON)
find_package(Boost REQUIRED COMPONENTS filesystem log program_options)
include_directories(${Boost_INCLUDE_DIRS})
link_libraries(${Boost_LIBRARIES})

相关文章

网友评论

      本文标题:cpp boost

      本文链接:https://www.haomeiwen.com/subject/jfxgyktx.html