Hide console of Windows Application

2019-01-03 23:34发布

I have a Qt application, and when I run this application, there is a console opening behind it. In development it is nice because i see debug outputs on the console, but when I want to give this executable to the customer there should be no console window. how do I hide it?

(I am using Visual Studio 2008)

11条回答
时光不老,我们不散
2楼-- · 2019-01-04 00:13

Go to: Projects --> Run and uncheck Run in terminal checkbox

查看更多
淡お忘
3楼-- · 2019-01-04 00:15

You can get rid of the console by calling:

FreeConsole();
查看更多
三岁会撩人
4楼-- · 2019-01-04 00:20

This worked for me:

CONFIG(debug, debug|release) {
    CONFIG *= console
} 
else {
    CONFIG -= console
}

I needed to run an exe to monitor a file using QFileSystemWatcher so I used this:

CONFIG -= console
查看更多
乱世女痞
5楼-- · 2019-01-04 00:22

I would suggest to check the presence of the following line in your .PRO file :

CONFIG += console

If you can find it, remove it ! It should fix your issue !

Hope it helps !

查看更多
狗以群分
6楼-- · 2019-01-04 00:24

It sounds like your linker configuration is incorrect. Right-click the project, Properties, Linker, System, SubSystem setting. Make sure "Windows" is selected, not "Console".

And, change main() to WinMain().

查看更多
太酷不给撩
7楼-- · 2019-01-04 00:27

For those of you editing the .vcxproj directly, you want to add a SubSystem with the value Windows to your Link ItemDefinitionGroup as follows:

<ItemDefinitionGroup>
  <Link>
    <SubSystem>Windows</SubSystem>
  </Link>
</ItemDefinitionGroup>
查看更多
登录 后发表回答