Prevent GTK from opening terminal in Windows

Anyone knows how to fix this? I’m trying to build a Windows portable version of my application, but this terminal keeps appearing when I open it.

If I close it, it kills the application

Sorry, this is completely unrelated to GTK but I guess is worth to post it, it’s my first time compiling on windows, but what I had to do is specify the windows subsystem.

It varies depending on the programming language and compiler/build tool, but in rust for example, you have to put this in your main.rs file.

#![windows_subsystem = "windows"]

References:

https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute

https://mesonbuild.com/Release-notes-for-0-56-0.html#add-support-for-all-windows-subsystem-types

1 Like

Thanks for the trick!

For the record, for non-Rust projects: those using meson to build can add win_subsystem=windows to their executable() command to achieve this. See the doc here.

1 Like