Qt GUI程序带命令行

时间:2021-01-28 12:25:20   收藏:0   阅读:0

Windows does not really support dual mode applications.

To see console output you need to create a console application

CONFIG += console

However, if you double click on the program to start the GUI mode version then you will get a console window appearing, which is probably not what you want. To prevent the console window appearing you have to create a GUI mode application in which case you get no output in the console.

One idea may be to create a second small application which is a console application and provides the output. This can call the second one to do the work.

Or you could put all the functionality in a DLL then create two versions of the .exe file which have very simple main functions which call into the DLL. One is for the GUI and one is for the console.

  •  
    Yes, this is what I‘ve come to realise - two apps! – Rob Jul 30 ‘10 at 9:01
  •  
    Having a small console app to call the main GUI app is fine, but is there any way to feed back the output to the console app in real time so the user can see what‘s going on, or to show typical output for things like -h, --version etc? – iforce2d May 27 ‘13 at 7:11
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!