我收到“cygwin_exception::open_stackdumpfile: 将堆栈跟踪转储到 TestProject.exe.stackdump”错误。我的项目只不过是一个 C++ HalloWorld 项目,其中包含一个附加类,我在其中设置和获取变量。我在尝试设置 Eigen 类型的矩阵变量时收到此错误。这是我的代码:
测试项目.cpp
#include <iostream>
#include "TestClass.hpp"
using namespace std;
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
TestClass testClass;
Eigen::MatrixXd XX = testClass.getVariable();
cout << "X = " << XX;
return 0;
}
测试类.hpp:
#ifndef TESTCLASS_HPP_
#define TESTCLASS_HPP_
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <unsupported/Eigen/MatrixFunctions>
#include <Eigen/Geometry>
class TestClass {
private:
Eigen::MatrixXd X;
public:
TestClass();
void setVariable(Eigen::MatrixXd);
Eigen::MatrixXd getVariable();
virtual ~TestClass();
};
#endif /* TESTCLASS_HPP_ */
最后是 TestClass.cpp:
#include "TestClass.hpp"
using namespace std;
TestClass::TestClass() {
X << 0, 1, 2;
}
TestClass::~TestClass() {
// TODO Auto-generated destructor stub
}
void TestClass::setVariable(Eigen::MatrixXd x){
X = x;
}
/* namespace std */
Eigen::MatrixXd TestClass::getVariable(){
return X;
}
我在控制台中得到的输出是:
!!!Hello World!!!
0 [main] TestProject 8416 cygwin_exception::open_stackdumpfile: Dumping stack trace to TestProject.exe.stackdump
值得一提的是,当我将类变量 X 的类型(以及方法和头文件中的所有相关类型)更改为整数时,我不会收到此错误,并且代码会编译并运行。
由于我在网上没有找到有用的信息,因此我将不胜感激。
Thanks