Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal error: Eigen/Dense: No such file or directory

Tags:

c++

debian

I have installed libeigen3-dev in order to compile programs using Eigen 3. when I include a file, such as Eigen/Dense I get this error when I try to run 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. 

Running the following line works fine:

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

shouldn't that include directory be automatically found by GCC because I installed the Eigen package through aptitude? Why are boost and OpenGL found automatically when I install the libraries but not Eigen? (Note that eigen is a header-only library, but that shouldn't matter right?)

Running g++ src/main.cpp -MMD -std=c++11 --verbose produces the following output:

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. 
like image 598
quant Avatar asked Apr 25 '14 04:04

quant


People also ask

What is Eigen dense?

The Eigen/Dense header file defines all member functions for the MatrixXd type and related types (see also the table of header files). All classes and functions defined in this header file (and other Eigen header files) are in the Eigen namespace.


1 Answers

I had this same problem on my Ubuntu 14 box. Ended up creating symlinks to get around it. With eigen3 installed in /usr/local/include do the following:

cd /usr/local/include sudo ln -sf eigen3/Eigen Eigen sudo ln -sf eigen3/unsupported unsupported 

You should now be able to include the headers by:

#include <Eigen/Dense> #include <unsupported/Eigen/FFT> 
like image 169
kbrown Avatar answered Oct 10 '22 19:10

kbrown