I run into the following error when I try to compile a modified version of this project: https://github.com/Wizaron/pytorch-cpp-inference 3

image.png1277×442 26.1 KB

I’m using the unzipped libtorch from Pytorch’s website. And here’s my CMakeLists.txt
make_minimum_required(VERSION 3.0 FATAL_ERROR)
project(cnn-classification)

find_package(Torch REQUIRED)
find_package(OpenCV REQUIRED)

add_executable(cnn-inference main.cc infer.cc ../../utils/opencvutils.cc ../../utils/torchutils.cc)

target_link_libraries(cnn-inference "${TORCH_LIBRARIES}")
target_link_libraries(cnn-inference "${OpenCV_LIBS}")

message(STATUS "OpenCV library status:")
message(STATUS "    version: ${OpenCV_VERSION}")
message(STATUS "    libraries: ${OpenCV_LIBS}")
message(STATUS "    include path: ${OpenCV_INCLUDE_DIRS}")


set_property(TARGET cnn-inference PROPERTY CXX_STANDARD 11)
#set_property(TARGET cnn-inference PROPERTY OUTPUT_NAME predict)

set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

Could someone help me with these linkage errors? Do I need to compile libtorch from source?
Thanks!