cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(Detect)
#set(Torch "/home/somnath/libtorch/share/cmake/Torch")
find_package(Torch REQUIRED)
find_package(OpenCV REQUIRED)
message(STATUS "CVINCLUDE: ${OpenCV_INCLUDE_DIRS}")
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(Detect main.cpp)
target_link_libraries(Detect ${TORCH_LIBRARIES}; ${OpenCV_LIBS})
字符串
${token_token};如果要使用${OpenCV_LIBS}构建代码,则两者不会同时工作。
enter image description here
2条答案
按热度按时间iibxawm41#
尝试将libTorch从Pre-cxx 11 ABI更改为cxx 11 ABI
https://pytorch.org/get-started/locally/
感谢来自https://stackoverflow.com/a/61459156/13045595的Jacob HM
yeotifhr2#
我也曾面临同样的问题。花了20多个小时来改变CMake文件和其他东西...但与CMakeLists.txt无关..如果你的代码中有“使用命名空间cv”,只需注解...它对我有效。希望它能解决你的问题。