Sunday, 10 November 2013

How to Hide "that Black Window"

Very often I get people asking, how do you hide the command prompt / console window that appears when you run an executable written in c/c++? Especially when you're using a GUI and "that black window" turns out to be an eyesore...

While the command prompt can be useful for debugging purposes, it is not especially nice to have the end user see it. AND it takes up a slot on the (Windows) taskbar. To fix this, change the linker settings. In MSVC, go to Project > Properties > Configuration Properties > Linker > System > SubSystem and choose Windows (/SUBSYSTEM:WINDOWS). The command prompt shouldn't appear by default now.

I haven't tried this out on gcc, but it seems to support a --subsystem windows flag.

No comments:

Post a Comment