line_det.cpp:(.text+0x1299):对‘cv::imshow(cv::String const&, cv::_InputArray const&)’未定义的引用 line_det.

/usr/bin/ld: warning: libmysqlclient.so.20, needed by //usr/lib/libgdal.so.20, not found (try using -rpath or -rpath-link)
CMakeFiles/line.dir/src/line_det.cpp.o:在函数‘imageCallback(boost::shared_ptr<sensor_msgs::Image_<std::allocator > const> const&)’中:
line_det.cpp:(.text+0x1299):对‘cv::imshow(cv::String const&, cv::_InputArray const&)’未定义的引用
line_det.cpp:(.text+0x12c1):对‘cv::waitKey(int)’未定义的引用
CMakeFiles/line.dir/src/line_det.cpp.o:在函数‘main’中:
line_det.cpp:(.text+0x19c2):对‘cv::namedWindow(cv::String const&, int)’未定义的引用
line_det.cpp:(.text+0x1a00):对‘cv::resizeWindow(cv::String const&, int, int)’未定义的引用

在这里插入图片描述
打开功能包的CMakeLists.txt文件,在文件中添加opencv库:

find_package(OpenCV REQUIRED)

在这里插入图片描述
然后在生成节点时也添加opencv库:

target_link_libraries(xxxx ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})

在这里插入图片描述
重新编译项目,就可以成功!

猜你喜欢

转载自blog.csdn.net/qq_42257666/article/details/123258264