Exception at exact same location on each build in C++

10 views (last 30 days)
Hi, I am trying to write .mat files using C++. I am using Microsoft Visual Studio 2019 along with Qt to develop my application.
MainWindow.h
#include <QtWidgets/QMainWindow>
#include "ui_mainwindow.h"
#include "mat.h"
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = Q_NULLPTR);
private:
Ui::MainWindowClass ui;
};
MainWindow.cpp
#include "mainwindow.h"
% Following exceptions are thrown even before starting with constructor:
% Exception thrown at 0x00007FFE85813E49 in MatFileTest2.exe: Microsoft C++ exception: mwboost::exception_detail::clone_impl<fl::filesystem::InvalidArgument> at memory location 0x000000BDFB52E410.
% Exception thrown at 0x00007FFE85813E49 in MatFileTest2.exe: Microsoft C++ exception: mwboost::exception_detail::clone_impl<fl::i18n::LcRscOpenFileFailure> at memory location 0x000000BDFB52E1B0.
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
MATFile* myFile = NULL;
mxArray* myData = NULL;
mwSize myRow = 1000000;
mwSize myCol = 1;
myData = mxCreateDoubleMatrix(myRow, myCol, mxREAL); % Line at which below exception is thrown:
% Exception thrown at 0x00007FFE85813E49 in MatFileTest2.exe: Microsoft C++ exception: foundation::core::except::detail::AnonymousInternalException<foundation::usm::NoActiveContextTypeError> at memory location 0x0000009D6A6FEFB8.
% This exception complains about .pdb file not being loaded
double* ary = new double[1000000];
for(int ii = 0; ii < 1000000; ++ii){
ary[ii] = ii*0.33;
}
myFile = matOpen("MATTest.mat", "w");
mxSetData(myData, ary);
matPutVariable(myFile, "Sweep_1", myData);
matClose(myFile);
}
The program is running fine and it is generating the 'MATTest.mat' file. But it keeps on throwing an exception in the output. This exception is thrown even before I enter the MainWindow Constructor. The most peculiar thing about these exceptions is that no matter how many times I run the solution the location of exception being thrown doesn't change. It is always: Exception thrown at 0x00007FFE85813E49. I guess this has something to do with my .exe file but I can't help but wonder why? My .exe file should get a different pointer each time the program is run then why the exception has the exact same location?
Can someone please help me with this problem? I am unable to find any concrete information regarding how to solve this on the internet.
Below is my configuration:
System: Windows 10 Pro, Version: 2004, OS build: 19041.572
IDE: Microsoft Visual Studio Community 2019, Version 16.7.6
Matlab: R2019a (9.6.0.1072779 (win64)
EDIT 1: I have posted the same question on Stack Overflow.

Answers (0)

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!