undefined reference to 'cv::imshow(cv::String const&, cv::_InputArray const&)'

1. Specific error report

When compiling (catkin build) svo_pro_ws, an error is reported:

Errors     << svo_ros:make /home/sharine/Mine/MyResearch/svo_pro_ws/logs/svo_ros/build.make.000.log
/home/sharine/Mine/MyResearch/svo_pro_ws/devel/.private/svo/lib/libsvo.so:对‘cv::imshow(cv::String const&, cv::_InputArray const&)’未定义的引用

2. Problem and cause

The version of opencv used does not match

3. Solution

To check the opencv version in the Linux system , execute the command:

pkg-config --modversion opencv

find find_package(OpenCV REQUIRED) in the CMakeLists.txt files in each package (in rpg_common, svo_ros, svo_direct, vikit/vikit_common and svo_online_loopclosing) and replace it with

# Ubuntu 18.04 + Melodic
find_package(OpenCV 3 REQUIRED)
# Ubuntu 20.04 + Noetic
find_package(OpenCV 4 REQUIRED)

Guess you like

Origin blog.csdn.net/weixin_37950717/article/details/125222107
CV