首页 > 解决方案 > 使用 conan 和 cmake 编译会出现致命错误 LNK1104

问题描述

试图在我的代码中编译和使用 3rd 方库。它实际上之前工作过,然后我尝试移动一个目录,即使在恢复到 . 我找到了一些相关的答案,但它已经对我有用,所以我认为它不应该是什么大问题。我正在使用 Visual Studio 2019 进行编译。相关的 CMakeList.txt 代码:

if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
   message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
   file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake"
                  "${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(REQUIRES boost/1.70.0-7
                         protobuf/3.11.2-1
                BASIC_SETUP)
target_link_libraries(main ${CONAN_LIBS})

错误是:

fatal error LNK1104: cannot open file 'libboost_atomic-vc141-mt-sgd-x64-1_70.lib'

标签: c++cmakeconan

解决方案


推荐阅读