c++ hide show console
To hide the console in a C++ program, you can use the following code:
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
Explanation:
- #pragma comment
: This is a directive that tells the linker to perform an action.
- linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup"
: This specifies that the program should be linked as a Windows subsystem application with the entry point at mainCRTStartup
. This effectively hides the console window when the program is run.
Note: Adding this code will hide the console window when the C++ program is executed.