Home > Enterprise >  Is there a way to turn off the std out console?
Is there a way to turn off the std out console?

Time:04-28

I would like to know if there is a Win32 function to stop the console from opening. It already does this for a int WINAPI wWinMain entry point function but with the regular int main entry point function, the console opens by itself. I want to know if Windows has a function to close it. I am using llvm clang.

Edit: I figured this out with the help of someone else. The option -Wl,subsystem:windows,entry/mainCRTStartup in the build file for the .exe application will tell it to treat it as a GUI app but make int main the entry point

CodePudding user response:

This might be controlled by the compiler.

For example, in the GCC documentation one can use the flag -mconsole if he wants a console application or the flag -mwindows if he wants a GUI application, without any console.

You probably have similar flags for Microsoft Compiler, you might want to read the documentation.

CodePudding user response:

I found the solution. The linker command -Wl,/subsystem:windows,/entry:mainCRTStartup will tell it that it is a GUI app but to use int main as the entry point

  • Related