我在win10上 . 我刚刚安装了mingw-w64 x86_64-7.1.0-win32-seh-rt_v5-rev0,并将Eigen3.3.3复制到include文件夹中 .

然后我将C:\ mingw-w64 \ x86_64-7.1.0-win32-seh-rt_v5-rev0 \ mingw64 \ bin添加到系统路径 .

c Hello世界正常运作 .

然后我想检查Eigen是否工作正常,我使用了Eigen文档中最简单的例子,如下所示

~~~
#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;
}
~~~

但是,我发现了一件奇特的事情 . 我编译了

g eigen_test.cpp

但是,运行a.exe根本不提供任何输出,甚至我将“std :: cout <<”hello“<< std :: endl”附加到上面代码的末尾,仍然没有输出 .

但是,如果我双击“ mingw-w64.bat " in mingw-w64 folder, and switch folder by cd, and using the same compilation " g eigen_test.cpp” . 然后它的工作原理!!!!

我真的不明白,因为mingw-w64.bat的唯一内容是将C:\ mingw-w64 \ x86_64-7.1.0-win32-seh-rt_v5-rev0 \ mingw64 \ bin附加到%PATH% . 但我已将此添加到我的系统路径中 .

怎么了?如何在没有执行.bat文件的情况下完成我的特征工作?