Linker Error Buiding from CLion - works from Command Line
已回答
Here's my CMake File:
cmake_minimum_required(VERSION 3.7)
project(untitled)
find_package(Boost REQUIRED)
find_package(CUDA REQUIRED)
find_package(OpenCV REQUIRED)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
target_link_libraries(${PROJECT_NAME} ${CUDA_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
I guess during build:
[ 50%] Linking CXX executable untitled
/usr/bin/ld: cannot find -lopencv_dep_cudart
collect2: error: ld returned 1 exit status
make[3]: *** [untitled] Error 1
make[2]: *** [CMakeFiles/untitled.dir/all] Error 2
make[1]: *** [CMakeFiles/untitled.dir/rule] Error 2
make: *** [untitled] Error 2
I have no problems building from command line. How to resolve?
Thanks
请先登录再写评论。
Hi! Please try adding set(CUDA_USE_STATIC_CUDA_RUNTIME OFF) to your CMakeLists.txt. Here is the related opencv issue - https://github.com/opencv/opencv/issues/6542.