I'm trying to avoid using 'start'.
As an example, in windows, goto command prompt and type "qtdemo", or "assistant".
How did they do it? I tried going through the .pro file, nothing that stands out.
I'm trying to avoid using 'start'.
As an example, in windows, goto command prompt and type "qtdemo", or "assistant".
How did they do it? I tried going through the .pro file, nothing that stands out.
Interesting. Neither of them returned in 4nt but they do in cmd.exe.
John
When I start my own Qt GUI applications from cmd.exe, they also return immediately to the prompt.
A console application doesn't, though.
A console application grabs the terminal. Under Unix the proper thing to do is to either call fork() and kill the parent or call daemon(). In either case the application detaches itself from the terminal.
We're using Microsoft Visual Studio and CMake to compile the program, so .pro files aren't used. Does anyone know where to change the settings and what to change it to so that it runs as a GUI application instead of a console application?
Thanks
/SUBSYSTEM:WINDOWS linker flag removes the console.
Here are two methods:
if(WIN32)
set_target_properties(WindowApplicationExample PROPERTIES
LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
set_target_properties(WindowApplicationExample PROPERTIES
RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
set_target_properties(WindowApplicationExample PROPERTIES
LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
set_target_properties(WindowApplicationExample PROPERTIES
MINSIZEREL "/SUBSYSTEM:WINDOWS")
endif(WIN32)
Or, you can do this: add_executable(myexe WIN32 myexe.cxx) See the documentation for add_executable.
There is more info on this if you google search for "How to hide the console for a VTK/Qt app"
Last edited by drescherjm; 29th June 2009 at 17:44.
John
Use a QApplication, not a QCoreApplication. Your project type then has to be changed from CONSOLE to GUI. Then just don't make a window.
Bookmarks