簡體   English   中英

使用柯南 find_package 提升鏈接錯誤

[英]Boost link error using Conan find_package

我正在嘗試通過柯南的 cmake_find_package 生成器使用 boost 構建一個簡單的程序。 我正在使用 Visual Studio 2019 並在鏈接過程中收到以下錯誤:

LNK1104:無法打開文件“libboost_filesystem-vc142-mt-s-x64-1_78.lib”

安裝的升壓柯南 package 僅包含libboost_filesystem.lib 如何鏈接到這個庫而不是libboost_filesystem-vc142-mt-s-x64-1_78.lib 還有另一種使用柯南提升的正確方法嗎?

柯南文件.txt:

[requires]
boost/1.78.0

[generators]
cmake_find_package

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.12)
project(TestProject)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_MODULE_PATH})

find_package(Boost REQUIRED COMPONENTS filesystem)

INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})

add_executable(main main.cpp)
target_link_libraries(main ${Boost_LIBRARIES})

主.cpp:

#include <boost/filesystem.hpp>
int main() {
    return 0;
}

柯南配置:

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
compiler.runtime=MT
build_type=Release
[options]
[build_requires]
[env]

添加

add_definitions(-DBOOST_ALL_NO_LIB) 

為我解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM