0

I have created an example.cpp file in Visual Studio which very simply has one line:

#include <gtk/gtk.h>

I am getting the following error:

cannot open source file "gtk/gtk.h"


Here are the steps I took to setup GTK+.

I downloaded the latest stable version of GTK+ from http://win32builder.gnome.org/ choosing gtk+-bundle_3.10.4-20131202_win64.zip.

I then followed gtk+-bundle_3.10.4-20131202_win64.README.txt with the following instructions.

To summarise:

  1. I added the bin folder to my path
  2. Ensured there was no prior version of GTK+ on the system
  3. Prepared Pango, GDK-Pixbuf and GTK+IMModules
  4. Verified it worked by running gtk3-demo
  5. Verified it was in the system by running pkg-config --cflags --libs gtk+-3.0 with the output:

-mms-bitfields -IE:/Developer/external/gtk-3.10.4_win64/include/gtk-3.0 -IE:/Developer/external/gtk-3.10.4_win64/include/cairo -IE:/Developer/external/gtk-3.10.4_win64/include/pango-1.0 -IE:/Developer/external/gtk-3.10.4_win64/include/atk-1.0 -IE:/Developer/external/gtk-3.10.4_win64/include/cairo -IE:/Developer/external/gtk-3.10.4_win64/include/pixman-1 -IE:/Developer/external/gtk-3.10.4_win64/include -I/srv/win32builder/fixed_3104/build/win64/include/freetype2 -I/srv/win32builder/fixed_3104/build/win64/include/libxml2 -IE:/Developer/external/gtk-3.10.4_win64/include/libxml2 -I/srv/win32builder/fixed_3104/build/win64/include/freetype2 -IE:/Developer/external/gtk-3.10.4_win64/include/libpng16 -IE:/Developer/external/gtk-3.10.4_win64/include/gdk-pixbuf-2.0 -IE:/Developer/external/gtk-3.10.4_win64/include/libpng16 -IE:/Developer/external/gtk-3.10.4_win64/include/glib-2.0 -IE:/Developer/external/gtk-3.10.4_win64/lib/glib-2.0/include -LE:/Developer/external/gtk-3.10.4_win64/lib -lgtk-3 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -lz -lpangocairo-1.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lm -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl

where E:/Developer/external/gtk-3.10.4_win64 is where I have extracted the GTK files to.

Hopeful Llama
  • 728
  • 5
  • 26

1 Answers1

2

2020-03-19 update:

This answer is old, I update that story on: https://stackoverflow.com/a/6008390/518853

Original content:

These builds are old. You should avoid getting your GTK+ binaries from random sources. The official way is documented on the official GTK+ website: https://www.gtk.org/download/windows.php

You're supposed to install MSYS2 which provides a whole lot of open-source packages for Windows. It uses the pacman package manager, which then allows you to install GTK+ 3. It always has the most up-to date version of GTK+ 3 (3.22.7-1 provided in MSYS2 as the date I'm writing).

liberforce
  • 11,189
  • 37
  • 48