1

我正在尝试将每个系统与之结合,ros但在此之前我想检查它是否运行良好,所以我运行 file on CLion,但出现了这些错误。

/home/ian/Downloads/clion-2017.2.1/bin/cmake/bin/cmake --build /home/ian/CLionProjects/mrqt --target mrpt -- -j 4
[ 50%] Linking CXX executable mrpt
/usr/bin/ld: warning: libopencv_imgcodecs3.so.3.2, needed by /usr/local/lib/libmrpt-base.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_imgproc3.so.3.2, needed by /usr/local/lib/libmrpt-base.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopencv_core3.so.3.2, needed by /usr/local/lib/libmrpt-base.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libmrpt-base.so: undefined reference to `cvLoadImage'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvConvertImage'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvReleaseImage'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvSplit'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvMatchTemplate'
/usr/local/lib/libmrpt-base.so: undefined reference to `_IplImage::_IplImage(cv::Mat const&)'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvCreateImage'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvSmooth'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvFlip'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvGetSize'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvCvtColor'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvCircle'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvGetQuadrangleSubPix'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvRemap'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvLine'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvSaveImage'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvCopy'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvCloneImage'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvSetImageROI'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvEqualizeHist'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvMinMaxLoc'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvMerge'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvResize'
/usr/local/lib/libmrpt-base.so: undefined reference to `cvUndistort2'
collect2: error: ld returned 1 exit status
CMakeFiles/mrpt.dir/build.make:94: recipe for target 'mrpt' failed
make[3]: *** [mrpt] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/mrpt.dir/all' failed
make[2]: *** [CMakeFiles/mrpt.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/mrpt.dir/rule' failed
make[1]: *** [CMakeFiles/mrpt.dir/rule] Error 2
Makefile:118: recipe for target 'mrpt' failed
make: *** [mrpt] Error 2

刚开始编译的时候还好,后来mrpt头文件出了点​​问题,我把头文件都删了,手动编译,就出现了这个问题。我能得到一些建议吗?

4

1 回答 1

0

您的系统中可能混合安装了不同的 MRPT 版本。

sudo make install除非您有充分的理由,否则我不建议您这样做;只需在其自己的构建目录中编译项目将生成一个MRPTConfig.cmake文件,该文件允许 CMake 从 ROS 或任何其他用户项目中找到 MRPT。

如果 CMake 没有自动找到,只需设置环境变量即可export MRPT_DIR=/home/xxx/path/to/mrpt/build

你现在的问题是清理所有可能存在的烂摊子/usr/local/。查看该目录,如果您make install编辑的唯一项目是 MRPT,我强烈建议使用sudo rm -fr /usr/local/*.

如果您有其他项目...嗯...您必须sudo make uninstall从 MRPT 构建目录运行,然后手动确保没有剩余文件。

针对 OpenCV 的链接错误也看起来像 CMake 为一个 opencv 版本配置了项目,然后安装了另一个(可能通过 ROS 包?)。完成上述清理后/usr/local,删除您当前的 MRPT CMake 构建目录并重新从头开始。

于 2017-08-21T21:55:09.977 回答