Could not find apackage configuration file provided by “Eigen3“

catkin_make编译报错

Could not find apackage configuration file provided by "Eigen3" with any
of the followingnames:
Eigen3Config.cmake
eigen3-config.cmake
Add theinstallation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set
"Eigen3_DIR"to a directory containing one of the above files. If "Eigen3"

解决方法

1、在cmakelist.txt文件添加以下语句

set(CMAKE_MODULE_PATH ${
    
    CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)

如果功能包有cmake/modules的文件夹,则跳过该步骤,到第二步

2、FindEigen3.cmake文件

在eigen/cmake文件夹里面查到FindEigen3.cmake文件,注意FindEigen3.cmake是当前安装的Eigen版本
可以通过运行以下命令查看

pkg-config --modversion eigen3

3、将FindEigen3.cmake复制到CMakeModules文件下

CMakeModules需要在功能包里面创建,如果功能包有cmake/modules的文件夹,直接将FindEigen3.cmake文件复制到cmake/modules的文件夹里面,重新编译即可

猜你喜欢

转载自blog.csdn.net/weixin_44023934/article/details/121701318