How do you install GTK+ 3.0 on Windows?

Hallelujah, I have found the sane non linux version of getting GTK for windows.

Someone was kind enough to upload to dropbox the GTK files, just download and extract. Here is the link for anyone else who bumps into this GTK/msys2 disaster.

https://www.dropbox.com/sh/8d1qbh5dsp044on/UgkALzhlqH

These files really ought to be available on the GTK Windows download page, it beggars belief.

Close this thread, viva windows.


Welcome, Google users from the future! Since I wrote this answer, the GTK+ website now has official installation instructions that cover what I said below but with more details and less pain. Refer to that page instead. The answer below has been kept for historical reasons.

The problem with the GTK+ website is that there is no one to maintain these binary distributions. The previous binary distribution for Windows was for GTK+ 3.6, which was released I believe way back in 2012, if not earlier. The current version is 3.16, and 3.18 is literally days away from being released. MSYS2 is the only supported installation mechanism, and it's updated frequently enough.

That being said, you need to install GTK+ separately if you use the MSYS route; MSYS doesn't come with GTK+ out of the box. Start with

pacman -Ss gtk3

That should give you a list of possible packages to install, including the GTK+ libraries for both 32-bit and 64-bit MinGW. I forget their exact names now.

Once you find the one you want, use

pacman -S package-name-here

to install it. Then, open the MinGW 32-bit or 64-bit Shell from the Start menu's MSYS folder to begin developing.

If you want a traditional IDE for GTK+ programming, look up GNOME Builder or Anjuta. For a graphical GUI designer, look up Glade.


I agree GNOME community is being a bit insolent to this point. They made GTK+ installation almost the same as the Linux installation, which is a bit like giving you pepsi in mcdonalds.

The worst is that it is forcing you to use their own crap to the extent that they even tell you what IDE to choose, how you will build your app, what will have in your app.. (Nothing personal, I will actually always prefer Linux, I'm just being unbiased)


Now to be specific, you explicitly mentioned Codeblocks. Do not use code::block's GTK+ Project, it is awfully outdated. You can, of course modify the script or create your own, but it is still going to slow you down and we, programmers value our time (I think)

The procedure of installing (to this day) GTK3 ver. 3.22.16 on windows 7 for use with Code::Blocks turns out to be pretty simple. First download MSYS2 and type within the msys2 shell:

pacman -S mingw-w64-x86_64-gtk3

(Enter y to confirm) Then

pacman -S mingw-w64-x86_64-toolchain base-devel (to make sure you'll have precompiled binaries of pkg-config and to make sure you will have the latest version of gcc)

Then you have some work in CodeBlocks, first set the new compiler, from the Codeblocks's compiler settings -> Toolchain executables. The new compiler should be located in C:\msys64\mingw64 (C or the disk you installed MSYS in)

Then link some libraries in Codeblocks's compiler settings -> Search directories: enter image description here These libraries will be enough to run this simple sample code:

#include <gtk/gtk.h>

static void activate (GtkApplication* app, gpointer user_data)
{
    GtkWidget *window;

    window = gtk_application_window_new(app);
    gtk_window_set_title(GTK_WINDOW (window), "Window");
    gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);
    gtk_widget_show_all(window);
}

int main (int argc, char *argv[])
{
    GtkApplication *app;
    int status;

    app     = gtk_application_new("org.gtk.example", G_APPLICATION_FLAGS_NONE);
    g_signal_connect(app, "activate", G_CALLBACK (activate), NULL);
    status  = g_application_run(G_APPLICATION (app), argc, argv);
    g_object_unref(app);

    return status;
}

and have a result like this:enter image description here