cpp boost

2020-09-22  本文已影响0人  hehehehe
#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})
上一篇 下一篇

猜你喜欢

热点阅读