气哭了的C++调试,cmake 找不到 eigen

这才刚刚开头,可是就是不知道错误在哪里?百度了问题后,打开了很多很多相关的解答,从昨天上午遇到这个问题,历经昨天下午和晚上,还是错误,终于在今天上午圆满解决了问题,但是也为自己的低效率担忧。

错误截图如下:

CMake Error atCMakeLists.txt:23 (find_package):

By not providing"FindEigen3.cmake" in CMAKE_MODULE_PATH this project has

asked CMake tofind a package configuration file provided by "Eigen3", but

CMake did not findone.


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"

provides aseparate development package or SDK, be sure it has been

installed.


百度的原因都是说项目下的 CMakeLists.txt 配置的不正确,无论如何配置都不正确

不过还好还好,终于找到终极解决方法。

以root 账号进入 Fedora 系统, 普通用户执行的时候出错。

给出项目的大致框架:项目名: TestDemo  ,  eigen 在文件夹 TestDemo中,

运行语句: cmake .. -DEIGEN3_INCLUDE_DIR=eigen -DCMAKE_CXX_COMPILER=/usr/bin/clang++

出现开头的错误。

解决方法如下, 原地址: http://stackoverflow.com/questions/34138879/unable-to-find-eigen3-with-cmake

  • Go to the Eigen source directory and run the CMake and installation steps

    > mkdir build
    > cd build
    > cmake ..
    > make install
问题完美解决。执行结果如下:

[root@localhost build]# cmake .. -DEIGEN3_INCLUDE_DIR=eigen -DCMAKE_CXX_COMPILER=/usr/bin/clang++
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   program_options
--   serialization
-- Configuring done
-- Generating done
-- Build files have been written to: /root/software/LSTM-ER/build

错误原因分析:下载的Eigen 是源码(个人认为,待考证)


 


你可能感兴趣的:(Linux,C++)