编译ROS项目报错
main.cpp:(.text+0x1e8): undefined reference to cv::namedWindow(cv::String const&, int)' main.cpp:(.text+0x20c): undefined reference to
cv::namedWindow(cv::String const&, int)’
collect2: error: ld returned 1 exit status
ptest_ros/CMakeFiles/ptest_ros.dir/build.make:192: recipe for target ‘/home/neardi/catkin_ws/devel/lib/ptest_ros/ptest_ros’ failed
make[2]: *** [/home/neardi/catkin_ws/devel/lib/ptest_ros/ptest_ros] Error 1
CMakeFiles/Makefile2:493: recipe for target ‘ptest_ros/CMakeFiles/ptest_ros.dir/all’ failed
make[1]: *** [ptest_ros/CMakeFiles/ptest_ros.dir/all] Error 2
Makefile:140: recipe for target ‘all’ failed
报错图片
解决办法
指定自己版本的opencv,我的是3.3.1,所以在下图位置添加3,保存后编译成功