我有一个我不明白的错误。当我执行代码时,我得到了:
例外géréeà0x00007FF9CC11A799 dansception.exe:Microsoft C ++例外:字符存储区0x000000ACEC0FE568。 eu lieu。
可以用英语将其翻译为
在ception.exe中XXXXX的未捕获异常:Microsoft C ++异常:发生在存储位置YYYYY的字符
我在这里遇到错误:
void NaiveBayesianNetwork::trainModel(mat& X, vec& y)
{
// Initial checks
if (X.n_cols != m_numFeatures)
throw "The dimension of 'X' data is not consistent with number of features";
if (X.n_rows != y.n_rows)
throw "Dimension of 'X' and 'y' are not consistent";
y = trunc(y); // only integer
cout << "max " << y.max() << " ; min " << y.min() << endl;
if (y.max() >= m_numClasses)
throw "The number of classes in 'y' is bigger than expected";
if (y.min() < 0.0)
throw "The class ids should be positive";
m_numberOfSample = X.n_rows;
//...
在if (y.min() < 0.0)
行上,但是如果我对其进行注释,则我得到了错误。因此,这与功能无关(它可以在上一版中使用)。 mat
和vec
是Armadillo库对象,它们在调用该函数的main
中创建。我打印了它们,它们看起来不错。
如果我尝试在这里捕获异常,我仍然会收到调试器错误,并且没有异常捕获。
我真的不明白这个问题,因为我没有使用指针(起初我什至没有使用引用,但是我遇到了同样的问题。我添加了引用以避免不必要的复制),所以我没有知道为什么有内存问题。调试器会讲Kernel.dll
,我不知道它是否有用。
提前感谢。
谢谢。