-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to close the console on the Windows? #1190
Comments
You may need to select windows as the windows Subsystem instead of rust’s console default, using the windows_subsystem attribute. So basically inserting this into your #![windows_subsystem = "windows"] You can also make this conditional so that you can still see debug output in debug builds:
|
Thank you. You solved my problem! |
How would we do this in a C++ example? |
You need to pass https://cmake.org/cmake/help/latest/command/add_executable.html |
You can add the WIN32 option in your CMakeLists.txt as follows:
Or open project's Properties-Link-System-SubSystem in your visual studio, change SUBSYSTEM:CONSOLE to SUBSYSTEM:WINDOWS And change your main function to WinMain in your main.cpp: #include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// Write your application logic here. The console window will not be displayed.
return 0;
} |
When I double-click to launch the application, the black console appears:
How to close the console on the Windows?
The text was updated successfully, but these errors were encountered: