szisziszilvi
5th January 2012, 12:01
Hi,
I'm creating a console application. I've created it in the Qt Creator with New File or Project (...) and I've changed the main just like this:
#include <QtCore/QCoreApplication>
#include <iostream>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
std::cout << "hello" << std::endl;
return a.exec();
}
The only problem around this is that when I run it it does not seem to finish. I have to terminate the program "roughly" by switching off the popping console window or running it from a command promt using Ctrl+C. In the Creator I get the message:
F:\(mypath)\myproject-build-desktop\release\myproject.exe exited with code -1073741510
I've found this thread:
http://www.qtcentre.org/threads/36205-Console-application-exit-application-and-order-of-code
but it does not seem to work for me or I'm not using it nice.
So at last the question is:
How to finish a qt console application correctly?
In the future it has to happen at specific eventy, most likely at a keyboard press, now how to achieve that? (I've seen that once somewhere, but I cannot find it anymore.)
Szilvi
I'm creating a console application. I've created it in the Qt Creator with New File or Project (...) and I've changed the main just like this:
#include <QtCore/QCoreApplication>
#include <iostream>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
std::cout << "hello" << std::endl;
return a.exec();
}
The only problem around this is that when I run it it does not seem to finish. I have to terminate the program "roughly" by switching off the popping console window or running it from a command promt using Ctrl+C. In the Creator I get the message:
F:\(mypath)\myproject-build-desktop\release\myproject.exe exited with code -1073741510
I've found this thread:
http://www.qtcentre.org/threads/36205-Console-application-exit-application-and-order-of-code
but it does not seem to work for me or I'm not using it nice.
So at last the question is:
How to finish a qt console application correctly?
In the future it has to happen at specific eventy, most likely at a keyboard press, now how to achieve that? (I've seen that once somewhere, but I cannot find it anymore.)
Szilvi