ICode9

精准搜索请尝试: 精确搜索
首页?>?其他分享> 文章详细

c – 致命错误:Eigen / Dense:没有这样的文件或目录

2019-09-30 10:06:54??阅读:8??来源: 互联网

标签:c?debian


我已经bet356体育下载_bet356客服邮箱_bet356官网了libeigen3-dev以便使用Eigen 3编译程序.当我包含一个文件时,例如Eigen / Dense我在尝试运行g时遇到此错误:

user@office-debian:~/Documents/prog$g++ src/main.cpp -MMD -std=c++11
In file included from src/main.cpp:9:0:
src/tdefs.h:16:23: fatal error: Eigen/Dense: No such file or directory
compilation terminated.

运行以下行正常工作:

g++ -I /usr/include/eigen3/ src/main.cpp -MMD -std=c++11

不应该包含目录由GCC自动找到,因为我通过aptitudebet356体育下载_bet356客服邮箱_bet356官网了Eigen包?为什么在bet356体育下载_bet356客服邮箱_bet356官网库而不是Eigen时会自动发现boost和OpenGL? (请注意,eigen是一个仅限标头的库,但这不重要吗?)

运行g src / main.cpp -MMD -std = c 11 –verbose产生以下输出:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5) 
COLLECT_GCC_OPTIONS='-MMD' '-std=c++11' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -MMD main.d -D_GNU_SOURCE src/main.cpp -quiet -dumpbase main.cpp -mtune=generic -march=x86-64 -auxbase main -std=c++11 -version -o /tmp/ccoYRPKY.s
GNU C++ (Debian 4.7.2-5) version 4.7.2 (x86_64-linux-gnu)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.7
 /usr/include/c++/4.7/x86_64-linux-gnu
 /usr/include/c++/4.7/backward
 /usr/lib/gcc/x86_64-linux-gnu/4.7/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++ (Debian 4.7.2-5) version 4.7.2 (x86_64-linux-gnu)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 66d178dd81da8c975e003e06d9f5e782
In file included from src/main.cpp:9:0:
src/tdefs.h:16:23: fatal error: Eigen/Dense: No such file or directory
compilation terminated.

解决方法:

使用–verbose开关运行编译器:

g++ --verbose ...

如果您的包含相对于此输出中显示的路径之一,则不必使用-I.这取决于如何配置gcc,它取决于bet356体育下载_bet356客服邮箱_bet356官网其他内容的位置.

注意 .通常不在-I路径中.

后来

在交换了几个注释之后,显然/usr/include / eigen3 / Eigen / Dense应该包括#include< Eigen / Dense>,而不是#include< eigen3 / Eigen / Dense>.因此,必须添加命令行选项-I /usr/include / eigen3.

某些bet356体育下载_bet356客服邮箱_bet356官网是否选择将头文件bet356体育下载_bet356客服邮箱_bet356官网到编译为gcc的目录中的目录中,取决于默认值,分发者做出的决策或bet356体育下载_bet356客服邮箱_bet356官网期间做出的决定.我会说“经常使用的”头文件(Boost)很好地放在/usr/local/include中,而一些“elitist”的东西在它自己的目录中会更好.



标签:c,debian

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有