I've been playing around with Qt Creator 4.5 under Linux. My application builds just fine under Linux, but if I build in Windows, the app always opens a console window at startup.
Can I stop it doing that?
I'm building using the default MinGW setup, perhaps that is related. If need be I can build with Visual Studio, but I'd like to understand what is happening first...
Edit: I just created a simple test GUI app with Qt Creator under Windows and it didn't exhibit this behaviour. Either this behaviour has occurred because of the way the project was created under linux, or there is something my app does which causes the console window to appear. Will post details when I diagnose it in case it helps someone else.
I use cmake instead of qmake. I used set(CMAKE_CXX_FLAGS "-mwindows") seems as though QMAKE_CXXFLAGS +=-mwindows in your .pro file would do the same.
Qt/2009.05/qt/mkspecs/win32-g++
edit file qmake.conf
modify line
QMAKE_LFLAGS_CONSOLE = -Wl,-subsyetem,console
to
QMAKE_LFLAGS_CONSOLE = -Wl,-subsyetem,windows
and modify your ???.pro file (example add new line or space)
and compiling
it`s working ok
I think that this is not a solution for this specific answer (besides it is 4 years later), but I think that many people landing in this thread will be looking for this setting:
Projects > Build and Run > Run Settings > Run > [x] Run in terminal
De-select it and run your GUI from QtCreator without an extra Terminal window. Terminal output will be then embedded in the IDE.
You will want to make sure the -mwindows switch is provided.
Edit:
alternatively, you can go into your makefile and add this to your linker flags:
Go to:
Projects --> Run
and uncheckRun in terminal
checkboxFor those who have this issue using CMake, I've found the real solution here. Verified by myself.
In short, you need to add
WIN32
to youradd_executable()
statements: