I found Raph Levien’s GTK+ Hello World page, typed in the code, and attempted to compile it. Unfortunately, while the code itself is functional, the suggested Makefile is definitely not. These days, we use the pkg-config program to generate flags for libraries like GTK+ to the compiler and linker, rather than hard-coding them. Also, some of the directory-finding stuff for libraries and headers is unnecessary today.
Thus, while you can use his “helloworld.c” program, you’ll probably want to use my Makefile instead, which follows.
CC = gcc CFLAGS = -O2 -pipe CFLAGS += $(shell pkg-config --cflags glib-2.0) CFLAGS += $(shell pkg-config --cflags gtk+-2.0) CXXFLAGS = $(CFLAGS) LIBS = $(shell pkg-config --libs gtk+-2.0) LIBS += $(shell pkg-config --libs glib-2.0) LDFLAGS = $(LIBS) #LDFLAGS = $(LIBS) -lgtk -lgdk -lglib -lX11 -lXext -lm OBJS = gtk_helloworld.o helloworld: $(OBJS) $(CC) $(OBJS) -o gtk_helloworld $(LDFLAGS) clean: rm -f *.o *~ gtk_helloworld