1. 程式人生 > 其它 >Ubuntu 編譯程式找不到 eigen 的解決方法

Ubuntu 編譯程式找不到 eigen 的解決方法

技術標籤:第三方庫的安裝與使用

一、問題描述

最近編譯程式的時候遇到:
Using these message generators: gencpp;geneus;genjava;genlisp;gennodejs;genpy
CMake Error at snap_map_icp/snap_map_icp/CMakeLists.txt:8 (find_package):
By not providing “FindEigen.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “Eigen”, but

CMake did not find one.

Could not find a package configuration file provided by "Eigen" with any of
 the following names:

EigenConfig.cmake
eigen-config.cmake

Add the installation prefix of “Eigen” to CMAKE_PREFIX_PATH or set
“Eigen_DIR” to a directory containing one of the above files. If “Eigen”

provides a separate development package or SDK, be sure it has been
installed.

– Configuring incomplete, errors occurred!

二、解決方法

在 /home 目錄下直接搜尋查詢 FindEigen.cmake 檔案, 然後把它複製到報錯的CMakeLists.txt 一樣的路徑下,
然後在 CMakeLists.txt 中新增

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
include_directories($ {EIGEN3_INCLUDE_DIRS}
)

然後再次編譯就OK~~~