eclipse cygwin_exception::open_stackdumpfile:将堆栈跟踪转储到 *.exe.stackdump

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31676122/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:45:32  来源:igfitidea点击:

cygwin_exception::open_stackdumpfile: Dumping stack trace to *.exe.stackdump

c++eclipsestack-traceeigen

提问by M.A.

I am getting "cygwin_exception::open_stackdumpfile: Dumping stack trace to TestProject.exe.stackdump" error. My project is nothing but a C++ HalloWorld project that contains an additional class in which I set and get a variable. I am getting this error at the line I try to set a matrix variable of type Eigen. Here is my code:

我收到“cygwin_exception::open_stackdumpfile: Dumping stack trace to TestProject.exe.stackdump”错误。我的项目只不过是一个 C++ HalloWorld 项目,其中包含一个额外的类,我在其中设置和获取一个变量。我在尝试设置 Eigen 类型的矩阵变量时遇到此错误。这是我的代码:

TestProject.cpp

测试项目.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;
}

TestClass.hpp:

测试类.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_ */

and finally the TestClass.cpp:

最后是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;
}

The output I get in the Console is:

我在控制台中得到的输出是:

!!!Hello World!!!
      0 [main] TestProject 8416 cygwin_exception::open_stackdumpfile: Dumping stack trace to TestProject.exe.stackdump

It is worth mentioning that when I change the type of the class variable X (and all related types in the methods and the header file) into an integer I don't get this error and the code compiles and runs.

值得一提的是,当我将类变量 X 的类型(以及方法和头文件中的所有相关类型)更改为整数时,我没有收到此错误并且代码编译并运行。

I would appreciate any help since I didn't find useful info online.

我很感激任何帮助,因为我没有在网上找到有用的信息。

Thanks

谢谢

回答by Christophe

You are using a dynamic sized Matrix X, and you try to comma initialize it without setting its size first. This will raise an exception:

您正在使用一个动态大小的矩阵 X,并且您尝试在没有先设置其大小的情况下对其进行逗号初始化。这将引发异常:

As explained here:

正如这里所解释的:

Eigen offers a comma initializer syntax which allows the user to easily set all the coefficients of a matrix, vector or array. Simply list the coefficients, starting at the top-left corner and moving from left to right and from the top to the bottom. The size of the object needs to be specified beforehand.

Eigen 提供了一个逗号初始化语法,允许用户轻松设置矩阵、向量或数组的所有系数。简单地列出系数,从左上角开始,从左到右,从上到下。需要事先指定对象的大小

and here:

这里

The coefficients must be provided in a row major order and exactly match the size of the matrix. Otherwise an assertion is raised.

系数必须按行主要顺序提供,并且与矩阵的大小完全匹配。否则会引发断言。

So resize your matrix first:

所以首先调整你的矩阵:

TestClass::TestClass() {
    X.resize (1,3); 
    X << 0, 1, 2;
}