Re: [gtk-list] compile problems



"M. Rosencrantz" <mjrose@u.washington.edu> writes:

> Hello, I am trying to build the hello world program described in the
> tutorial document.  I am having some trouble however.  I am sure I am
> doing something really stupid, as I am new to linux programming.

I think I know what your problem is.  I had a similar difficulty a
couple of weeks ago when I first started messing with Gtk seriously.
It turns out that the Makefile on the web page is not quite right.  I
sent the fix below to the web page maintainer, but didn't hear back,
so here it again is for anyone interested:

To: amundson@cs.umn.edu
Subject: Correction/enhancement to helloworld Makefile
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: text/plain; charset=US-ASCII
From: Rob Browning <rlb@cs.utexas.edu>
Date: 20 Jul 1997 22:56:13 -0500
Message-ID: <87vi25kqhu.fsf@nevermore.csres.utexas.edu>
X-Mailer: Gnus v5.4.63/Emacs 19.34
Lines: 31
Xref: nevermore.csres.utexas.edu misc-mail:3117

This is in regard to the helloworld Makefile on the Gtk documentation
web page.

The main change I made was to make sure that the .o file is handed to
the linker before the rest of the libraries.  Some versions (newer
ones under Linux) have problems otherwise.  I also added the GTK_BASE
variable which makes changing the install dir a little easier.

Here's the whole thing if you're interested.

GTK_BASE=/usr/local/gtk+

GTK_INCLUDE = -I${GTK_BASE}/include
GTK_LIB = -L${GTK_BASE}/lib
X11_LIB = -L/usr/X11R6/lib
CC = gcc -g -Wall
CFLAGS = $(GTK_INCLUDE)
LDFLAGS = $(GTK_LIB) $(X11_LIB)
LOADLIBES = -lgtk -lgdk -lglib -lX11 -lXext -lm

OBJS = helloworld.o

helloworld:	$(OBJS)
#	$(CC) $(GTK_LIB) $(X11_LIB) $(OBJS) -o helloworld $(LDFLAGS)

clean:
	rm -f *.o *~ helloworld

-- 
Rob



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]