[英]C++ cmake throwing error
I am running sample programs in g2o graph library in linux using cmake. 我正在使用cmake在Linux的g2o图形库中运行示例程序。 I am getting the following error.
我收到以下错误。 The file i am running has the following code
我正在运行的文件具有以下代码
#include <Eigen/Core>
which is causing the error. 这是导致错误的原因。
[ 3%] Building CXX object data_fitting/CMakeFiles/circle_fit.dir/circle_fit.o g2o/trunk/g2o/examples/data_fitting/circle_fit.cpp:27:2 3: fatal error: Eigen/Core: No such file or directory
compilation terminated.
make[2]: *** [data_fitting/CMakeFiles/circle_fit.dir/circle_fit.o] Error 1
make[1]: *** [data_fitting/CMakeFiles/circle_fit.dir/all] Error 2
I am new to using cmake. 我是使用cmake的新手。 Is this because of an error in the CMakeLists.txt file?
这是因为CMakeLists.txt文件中的错误吗?
INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR})
ADD_EXECUTABLE(circle_fit
circle_fit.cpp
)
SET_TARGET_PROPERTIES(circle_fit PROPERTIES OUTPUT_NAME circle_fit${EXE_POSTFIX})
TARGET_LINK_LIBRARIES(circle_fit core solver_csparse)
ADD_EXECUTABLE(curve_fit
curve_fit.cpp
)
SET_TARGET_PROPERTIES(curve_fit PROPERTIES OUTPUT_NAME curve_fit${EXE_POSTFIX})
TARGET_LINK_LIBRARIES(curve_fit core)
I am struggling with this for a day now. 我现在为此努力了一天。 The tutorials available for cmake are also not helping much.
可用于cmake的教程也无济于事。 How can I fix this error?
如何解决此错误?
I tried adding include statement for /usr/include/eigen3 as the first answer suggested. 我尝试为/ usr / include / eigen3添加include语句作为建议的第一个答案。 But I cannot find any file named eigen3 in the /usr/include directory.
但是我在/ usr / include目录中找不到任何名为eigen3的文件。
Is there any other possible path? 还有其他可能的方法吗? How can I find it in linux?
如何在Linux中找到它?
Try to include the eigen include folder in cmake. 尝试将本征包含文件夹包含在cmake中。
INCLUDE_DIRECTORIES( /usr/include/eigen3 )
It worked for me on the same error. 它为我解决了同样的错误。
The readme says that you need to install libeigen3-dev ( https://svn.openslam.org/data/svn/g2o/trunk/README ) 自述文件说您需要安装libeigen3-dev( https://svn.openslam.org/data/svn/g2o/trunk/README )
If you are on Ubuntu user install it using apt-get or synaptic. 如果您使用的是Ubuntu用户,请使用apt-get或synaptic安装它。
And for Windows : 对于Windows:
"If you are compiling on Windows, please download Eigen3 and extract it. Within cmake-gui set the variable G2O_EIGEN3_INCLUDE to that directory" “如果在Windows上编译,请下载Eigen3并将其解压缩。在cmake-gui中,将变量G2O_EIGEN3_INCLUDE设置到该目录”
Do read the 'readme' :) 请阅读“自述文件” :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.