编译calibration_publisher时遇到关于opencv的报错

在ubuntu18.04系统上编译calibration_publisher这样一个ROS package时遇到如下报错:

undefined reference to `cv::read(cv::FileNode const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'

参考网上的一些解决办法:

  1. https://answers.ros.org/question/332086/error-when-building-package-of-calibration_publisher-while-installing-autoware/
  2. https://github.com/Autoware-AI/autoware.ai/pull/2090/commits/63abbb1c4d26be67ea0312b04b6dd9918cef3978

方法1中提到说出现这种问题是因为 “This error occurs when the opencv library cannot be loaded. ”

参考以上提供的解决方法后,在calibration_publisher中的CMakeLists.txt中添加一行代码(如下图)即解决问题:
在这里插入图片描述

你可能感兴趣的:(编译calibration_publisher时遇到关于opencv的报错)