Мой файл CMakeLists.txt:
Код: Выделить всё
cmake_minimum_required(VERSION 3.10)
project(MyProject)
find_package(Boost REQUIRED COMPONENTS program_options)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(my_program po_demo.cpp)
target_link_libraries(my_program Boost::program_options)
Код: Выделить всё
#include
#include
namespace po = boost::program_options;
int main(int argc, char** argv) {
try {
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("input-file", po::value(), "set input file")
("output-file", po::value(), "set output file")
("verbose,v", "enable verbose output")
("optimization-level", po::value()->default_value(0), "set optimization level")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
if (vm.count("help")) {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79276208/boostprogram-options-in-window-conda-environment-throws-bad-allocation[/url]