How to use Windows console in a QT Widget Application?
Hi!
I making a GUI program using QtCreator3.4.0 and i would like to use the console to see some things(i would like to test some lists sizes and other simple things like check the value of a variable in some part of the code, i think is more fast then debug). I'm using Windows 8.1 and MinGw4.9.1.
I read here i have to add "CONFIG += console" in my .pro file and i did it, i added too "include <iostream> using namespace std;" in my .cpp file but when i try to use "cout << "test";" i get the following error message.
Quote:
crt0_c.c:-1: error: undefined reference to `WinMain@16'
collect2.exe:-1: error: error: ld returned 1 exit status
How can i do that?
Re: How to use Windows console in a QT Widget Application?
I use Visual Studio write Qt Application.In vs,just set link--system--subsystem(CONSOLE).
Re: How to use Windows console in a QT Widget Application?
Assuming that it built correctly before you changed the pro file... Did you rerun qmake after changing the pro file?
Re: How to use Windows console in a QT Widget Application?
Didn't know i had to do this, ChrisW67. I did it, actually i went to sleep and now i started my system and reopened qtcreator is working!
Re: How to use Windows console in a QT Widget Application?
If you are using Qt Creator, you can simply #include <QDebug> and insert qDebug() statements in your code. When you run the program in debug mode, the debug statement output appears in the Application output window of Qt Creator. No need to mess up your application configuration for something as simple as printing diagnostics at runtime.