Oct '24 (edited) • VALUE
How to remove the Console Window from your release exe
I asked this in the last Q&A and got a couple of breadcrumbs and spent a few mins exploring this today.
suggested adding a '-mwindows' flag to the compiler. This works when you launch the program through VSCode but unfortunately doesn't when you run the exe from a file explorer or the desktop for example.
I asked the AI and used the GoogleFu and I think I came to the conclusion that because oogabooga is by default a console app and not a windows gui app the -mwindows flag doesn't work. I tried adding a manifest file to the compiler as well as a bunch of other flags to no avail (I could be doing this wrong lol).
I think basically you just need to make the exe a windows gui app by running WinMain() instead of main(). I didn't spend the time to work out how to change this in the oogabooga files but did come across a hack.
Add something like this to your code - It's Windows specific so be aware of that.
HANDLE hConsole = GetConsoleWindow();
if (hConsole != NULL)
{
ShowWindow(hConsole, SW_HIDE);
}
The console window will spawn but will quickly be minimized and then disappear.
I believe if the program was using WinMain() you could use the -mwindows flag on your release build and -mconsole on your debug build and things would be sweet but I am not really sure. There might be other reasons to not use WinMain() that I have no idea about.
If anyone has any better solutions. Please let me know! Cheers Bell
4
3 comments
James Roberts
4
How to remove the Console Window from your release exe
powered by
Ooga Booga Game Devs
skool.com/game-dev-grinders-8513
A group for game devs who want to ship great games from scratch in C, while mastering the ancient art of Caveman Programming
Build your own community
Bring people together around your passion and get paid.
Powered by