Reputation: 307
I use Qt5.2 (git) with MSVC13 on Windows. If I build any application (even the templates) it always opens in a cmd.exe window. I tried different Qt versions and different compilers (even MinGW), but I always have the same problem. If however, I start the application using the green play button in QtDesigner it opens without a cmd window. As suggested here I tried "CONFIG -= console" with no effect. Also I dont use testlib. In my qmake.conf I see the line "QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS"
Does this depend on the dll files I put in the application directory? QtDesigner does not copy any dlls to the build folder, however it sets some environment variables. To run the application from a separate folder I copy the corresponding dlls from the Qt lib folder into the applications exe folder.
Any ideas for this strange behaviour?
Upvotes: 2
Views: 4224
Reputation: 307
Ok, this took a while, but i finally found the solution here: Hide console of Windows Application
I had to replace the main entry function:
Replace the following code:
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
// your code*
}
by
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char*, int nShowCmd)
{
int argc = 0;
QApplication app( argc, 0 );
}
Thanks everybody!
Upvotes: 2
Reputation: 9818
In MSVC 2013 go to your project properties/ linker and change from:
/SUBSYSTEM:CONSOLE
To:
/SUBSYSTEM:WINDOWS
It worked for me.
Upvotes: 3