我无法让Eigen开始工作。
根据this link,我必须使用
g++ -I /path/to/eigen/ my_program.cpp -o my_program
但这不适用于mingw
所以我看看mingw doc here。我似乎应该将Eigen文件夹放入c:/mingw/include
。所以我做了,但仍然没有工作
这是C ++源代码
#include <iostream>
#include <Eigen/Dense>
using Eigen::MatrixXd;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << m << std::endl;
}
这是--verbose
的输出D:\w\WORK\C++program\use eigen>g++ firsteigen.cpp --verbos
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw-w64/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/5
.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-5.2.0/configure --host=x86_64-w64-mingw32 --bu
ild=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysr
oot=/c/mingw520/x86_64-520-win32-seh-rt_v4-rev0/mingw64 --with-gxx-include-dir=/
mingw64/x86_64-w64-mingw32/include/c++ --enable-shared --enable-static --disable
-multilib --enable-languages=c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-t
ime=yes --enable-threads=win32 --enable-libgomp --enable-libatomic --enable-lto
--enable-graphite --enable-checking=release --enable-fully-dynamic-string --enab
le-version-specific-runtime-libs --disable-isl-version-check --disable-libstdcxx
-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win3
2-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with
-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib
--with-gmp=/c/mingw520/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mi
ngw520/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw520/prerequisi
tes/x86_64-w64-mingw32-static --with-isl=/c/mingw520/prerequisites/x86_64-w64-mi
ngw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-W64 projec
t' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/
c/mingw520/x86_64-520-win32-seh-rt_v4-rev0/mingw64/opt/include -I/c/mingw520/pre
requisites/x86_64-zlib-static/include -I/c/mingw520/prerequisites/x86_64-w64-min
gw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw520/x86_64-520-win32-seh-rt_v
4-rev0/mingw64/opt/include -I/c/mingw520/prerequisites/x86_64-zlib-static/includ
e -I/c/mingw520/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLA
GS='-pipe -L/c/mingw520/x86_64-520-win32-seh-rt_v4-rev0/mingw64/opt/lib -L/c/min
gw520/prerequisites/x86_64-zlib-static/lib -L/c/mingw520/prerequisites/x86_64-w6
4-mingw32-static/lib '
Thread model: win32
gcc version 5.2.0 (x86_64-win32-seh-rev0, Built by MinGW-W64 project)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=core2' '-march=nocona'
c:/mingw-w64/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/5.2.0/cc1plus.exe -q
uiet -v -iprefix c:/mingw-w64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/ -
U_REENTRANT firsteigen.cpp -quiet -dumpbase firsteigen.cpp -mtune=core2 -march=n
ocona -auxbase firsteigen -version -o C:\temp\ccRjLnLZ.s
GNU C++ (x86_64-win32-seh-rev0, Built by MinGW-W64 project) version 5.2.0 (x86_6
4-w64-mingw32)
compiled by GNU C version 5.2.0, GMP version 6.0.0, MPFR version 3.1.3,
MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "c:/mingw-w64/mingw64/lib/gcc/../../lib/gcc/x86_64-
w64-mingw32/5.2.0/include"
ignoring nonexistent directory "C:/mingw520/x86_64-520-win32-seh-rt_v4-rev0/ming
w64C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../include"
ignoring duplicate directory "c:/mingw-w64/mingw64/lib/gcc/../../lib/gcc/x86_64-
w64-mingw32/5.2.0/include-fixed"
ignoring duplicate directory "c:/mingw-w64/mingw64/lib/gcc/../../lib/gcc/x86_64-
w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "C:/mingw520/x86_64-520-win32-seh-rt_v4-rev0/ming
w64/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
c:/mingw-w64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/include
c:/mingw-w64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/include-fixed
c:/mingw-w64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64
-w64-mingw32/include
c:/mingw-w64/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++
c:/mingw-w64/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/x86_64-w64-mi
ngw32
c:/mingw-w64/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/backward
End of search list.
GNU C++ (x86_64-win32-seh-rev0, Built by MinGW-W64 project) version 5.2.0 (x86_6
4-w64-mingw32)
compiled by GNU C version 5.2.0, GMP version 6.0.0, MPFR version 3.1.3,
MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: fb424bf2d94fed3543366c13b326a53d
firsteigen.cpp:2:23: fatal error: Eigen/Dense: No such file or directory
compilation terminated.
答案 0 :(得分:1)
我们假设完整路径为c:/some/random/path/Eigen/Dense
。您需要传递给gcc的包含路径是c:/some/random/path/
。请注意,在Dense
文件的同一级别,您应该拥有src
文件夹。