在 Clion 中设置 Boost

Setup Boost in Clion(在 Clion 中设置 Boost)

本文介绍了在 Clion 中设置 Boost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Clion 和 MinGW 中使用 Boost 库?我已将

解决方案

我使用 MinGW 发行版Stephan T. Lavavej 预建了 Boost 库.

在我的 cmaklist.txt 中我添加了这个

set(Boost_INCLUDE_DIR c:/mingw/include/)设置(Boost_LIBRARY_DIR c:/mingw/lib/)find_package(需要提升组件系统文件系统)包含目录(${Boost_INCLUDE_DIR})

这篇文章帮助我开始.如何使用 CMake 将外部库 (boost) 包含到 CLion C++ 项目中?

How to use Boost library in Clion with MinGW ? I have downloaded and unzipped boost_1_60_0.zip to C:oost_1_60_0. What am I supposed to do now ? Do I have to install something ? Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.3)
project(server_client)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -s -O3")
set(CMAKE_EXE_LINKER_FLAGS -static)

set(BOOST_ROOT "C:/boost_1_60_0")
set(BOOSTROOT "C:/boost_1_60_0")
find_package(Boost 1.60.0)
if(NOT Boost_FOUND)
    message(FATAL_ERROR "Could not find boost!")
endif()

set(SOURCE_FILES chat_server.cpp)
add_executable(server_client ${SOURCE_FILES})

Can not find Boost:

解决方案

I use MinGW distro by Stephan T. Lavavej with Boost libraries prebuilt.

In my cmaklist.txt I added this

set(Boost_INCLUDE_DIR c:/mingw/include/)
set(Boost_LIBRARY_DIR c:/mingw/lib/)
find_package(Boost COMPONENTS system filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIR})

This post help me get it going. How to include external library (boost) into CLion C++ project with CMake?

这篇关于在 Clion 中设置 Boost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在 Clion 中设置 Boost

基础教程推荐