View Full Version : I want run one application with GUI or Console based on commandline

30th March 2011, 10:18
if "Config += console" is added in the ".pro" file, the GUI application will show a console in background, how I remove this console window?
or how can I start a console in code without using "Config += console".

My Sample code is as following.

main(int argc, char *argv[])
any suggestion?

30th March 2011, 10:37
The easiest way according to me:

1. Create a dll with the core functionality
2. Create a command line tool using that dll
3. Create a gui tool using that dll
4. Create a script that takes a parameter and starts either the command line tool or the gui tool.

30th March 2011, 11:11
I am assuming you are talking about doing that on Windows (since everything works natively on Linux and Mac OS X). If so, tbscope has indeed given you one possible way of achieving what you are after. Personally, I don't like the idea of the script. Instead, I went for a .com and a .exe version of my application. For more information, you might want to check a thread I started on this a couple of months ago: http://www.qtcentre.org/threads/38171-Both-a-command-line-and-GUI-application-at-the-same-time.