I am getting this issue when building ORB_SLAM2_CUDA
[ 73%] Linking CXX executable rgbd_tum ../lib/libORB_SLAM2_CUDA.so: undefined reference to cv::cuda::createGaussianFilter(int, int, cv::Size_, double, double, int, int)' ../lib/libORB_SLAM2_CUDA.so: undefined reference to cv::cuda::copyMakeBorder(cv::_InputArray const&, cv::OutputArray const&, int, int, int, int, int, cv::Scalar, cv::cuda::Stream&)' ../lib/libORB_SLAM2_CUDA.so: undefined reference to cv::cuda::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int, cv::cuda::Stream&)' ../lib/libORB_SLAM2_CUDA.so: undefined reference to cv::cuda::StreamAccessor::wrapStream(CUstream_st*)' collect2: error: ld returned 1 exit status CMakeFiles/rgbd_tum.dir/build.make:162: recipe for target 'rgbd_tum' failed make[2]: *** [rgbd_tum] Error 1 CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/rgbd_tum.dir/all' failed make[1]: *** [CMakeFiles/rgbd_tum.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2
Solution:
Change the line99~line105 in CMakeLIst.txt
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${EIGEN3_LIBS} ${Pangolin_LIBRARIES} ${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o.so nvToolsExt )
To
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${EIGEN3_LIBS} ${Pangolin_LIBRARIES} ${PROJECT_SOURCE_DIR}/Thirdparty/DBoW2/lib/libDBoW2.so ${PROJECT_SOURCE_DIR}/Thirdparty/g2o/lib/libg2o.so nvToolsExt opencv_cudabgsegm opencv_cudaobjdetect opencv_cudastereo opencv_cudafeatures2d opencv_cudacodec opencv_cudaoptflow opencv_cudalegacy opencv_cudawarping opencv_cudaimgproc opencv_cudafilters )