我无法弄清楚为什么图书馆无法链接到我的项目,任何帮助将不胜感激。
背景:外部库提供了头文件和库文件的列表,并放在名为" dll"的目录中,文件包括" Elveflow64.aliases"," Elveflow64.dll"" Elveflow64.ini"" Elveflow64.lib"" Elveflow64.h"" * H&#34 ;, " lvanlys.dll"
我在CMakeLists文件中使用的代码如下所示:
SET("LIB_Elveflow_DIR" ${CMAKE_CURRENT_SOURCE_DIR}/dll)
include_directories(${LIB_Elveflow_DIR})
add_library(Elveflow64 SHARED IMPORTED) #${LIB_Elveflow_DIR}//Elveflow64.lib
set_property(TARGET Elveflow64 PROPERTY IMPORTED_LOCATION ${LIB_Elveflow_DIR}/Elveflow64.dll)
set_property(TARGET Elveflow64 PROPERTY IMPORTED_IMPLIB ${LIB_Elveflow_DIR}/Elveflow64.lib)
set_property(TARGET Elveflow64 PROPERTY IMPORTED_LINK_DEPENDENT_LIBRARIES ${LIB_Elveflow_DIR}/lvanlys.dll)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} Elveflow64)
但是,当我运行代码时,由于缺少Elveflow64.dll,程序意外完成。