-2

I'm running the "hello-world" code from the GTK tutorial:

#include <gtk/gtk.h>

int main(int argc, char* argv[])
{
    GTKWidget *window;
    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_show(window);

    gtk_main();

    return 0;
}

and I'm receiving this error, when I compile it using:

$ gcc base.c -o base `pkg-config --cflags --libs gtk+-2.0`

base.c: In function ‘main’:
base.c:5:2: error: unknown type name ‘GTKWidget’
  GTKWidget *window;

It seems that the issue isn't that gtk.h isn't included, but rather that GTKWidget isn't a thing?

unwind
  • 391,730
  • 64
  • 469
  • 606
galois
  • 825
  • 2
  • 11
  • 31

1 Answers1

5

C is case-sensitive. The name of the type is GtkWidget:

GtkWidget *window;

In general GTK+ types have a Gtk prefix, while the macros have GTK, this is a common naming scheme in C.

unwind
  • 391,730
  • 64
  • 469
  • 606