I am dealing with NI DAQmx and they define unsigned long as uInt32. I declare uInt32 array [1048*1024] in the header file and it compiles, but when I try to run it, it seems to freeze, and when I stop it, it exits with an error:
The program has unexpectedly finished.
D:\Projects\build-BlackAndWhite12bit-Desktop_Qt_5_1_1_MinGW_32bit-Debug\debug\BlackAndWhite12bit.exe exited with code -1073741571
Well, it does not say that there is not enough memory, but since I allocate 4*1048*1024 = 4,292,608 bytes, and my version is Qt Creator 2.8.1 Based on Qt 5.1.1 (MSVC 2010, 32 bit) on Win7 x64, I expect it to not have enough memory.
I found a similar question Qt Creator - calloc fails with large memory, but the only solution that works for me, would be, probably, moving to 64bit. But how do I do that? I tried to download the application from this website with the Qt 5.2.1 for Windows 64-bit (VS 2012, 556 MB) link. But when I got it, it seems to be a 32bit version configured for 64bit. Is this the one I need? Do I need OpenGL?
Is there a way to allow more memory for my current Qt version? Any other ways to go around my problem?
Here's the .h content:
#ifndef MAIN12BITSAMPLING_H
#define MAIN12BITSAMPLING_H
#include <QMainWindow>
#include "nivision.h"
#include "nivis.h"
#include "NIDAQmx.h"
namespace Ui {
class main12bitSampling;
}
class main12bitSampling : public QMainWindow
{
Q_OBJECT
public:
explicit main12bitSampling(QWidget *parent = 0);
~main12bitSampling();
...
uInt32 ddata[1073152];
...
signals:
private slots:
private:
Ui::main12bitSampling *ui;
};
#endif // MAIN12BITSAMPLING_H
Here's the main.c:
#include "main12bitsampling.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
main12bitSampling w;
w.show();
return a.exec();
}
And here's the main12bitsampling.cpp:
main12bitSampling::main12bitSampling(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::main12bitSampling)
{
ui->setupUi(this);
mainLoop();
}
main12bitSampling::~main12bitSampling()
{
delete ui;
}