How to compile the project for Windows?

I’m learning to use GTK, but I don’t know how to compile it for Windows. Could anyone tell me how I could compile this Hello Word project in GTK?

https://github.com/jadsongmatos/gnome-rust-base

Hi @jadsongmatos,

I suggest installing MSYS2 and following the instructions at The GTK Project - A free and open-source cross-platform widget toolkit

Note: MSYS2 recently switched to the UCRT toolchain, however the page on gtk.org has not been updated yet. As such, you have to change package prefixes from mingw-w64 to mingw-w64-ucrt. For example, change mingw-w64-x86_64-gtk4 to mingw-w64-ucrt-x86_64-gtk4, etc.

To develop with Rust using Meson, you’ll probably need to install additional packages like mingw-w64-ucrt-x86_64-rustc and mingw-w64-ucrt-x86_64-meson. For anyhting that’s missing, search on Packages - MSYS2 Packages or ask here directly!

1 Like

Do you have an example in rust that you can see?

Hi,

For Rust, there are some setup instructions on Windows in the handbook:
https://gtk-rs.org/gtk4-rs/stable/latest/book/installation_windows.html

(can’t help more, I’m not a Rust user…)

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.