Re: compiling gtk project



Hi:


On Sun, 2001-12-09 at 01:04, Mariusz Bozewicz wrote:
Hi
I have one stupid problem with compiling little project. I put some
own functions (these functions use gtk functions) in other files.
My Makefile looks like this:

CC=gcc
EXECUTE_SCRIPT=`gtk-config --cflags --libs`
model: kolory.o event.o modele.o menu.o area.o main.o
        $(CC) -o kolory.o event.o modele.o menu.o area.o main.o

kolory.o: kolory.c modele.h
        $(CC) -c  kolory.c $(EXECUTE_SCRIPT)

event.o: event.c modele.h
        $(CC)  -c event.c $(EXECUTE_SCRIPT)
modele.o: modele.c modele.h
        $(CC)  -c modele.c $(EXECUTE_SCRIPT)
menu.o: menu.c modele.h
        $(CC)  -c menu.c $(EXECUTE_SCRIPT)
area.o: area.c  modele.h
        $(CC)  -c area.c $(EXECUTE_SCRIPT)
main.o: main.c modele.h
        $(CC)  -c main.c $(EXECUTE_SCRIPT)

make returns similar warnings for all .o files:
gcc -c  kolory.c `gtk-config --cflags --libs`
gcc: -lgtk: linker input file unused since linking not done
gcc: -lgdk: linker input file unused since linking not done
gcc: -lgmodule: linker input file unused since linking not done
gcc: -lglib: linker input file unused since linking not done
gcc: -ldl: linker input file unused since linking not done
gcc: -lXi: linker input file unused since linking not done
gcc: -lXext: linker input file unused since linking not done
gcc: -lX11: linker input file unused since linking not done
gcc: -lm: linker input file unused since linking not done
gcc -o kolory.o event.o modele.o menu.o area.o main.o

and for "model" target it returns:
gcc -o kolory.o event.o modele.o menu.o area.o main.o
event.o: In function `delete_event':
event.o(.text+0x7): undefined reference to `gtk_main_quit'
event.o: In function `on_activate_MODELE':
event.o(.text+0x65): undefined reference to `gdk_draw_rectangle'
event.o(.text+0x93): undefined reference to `gtk_widget_draw'
event.o: In function `on_expose_event':
event.o(.text+0xf8): undefined reference to `gdk_draw_pixmap'
event.o: In function `on_configure_event':
.....
.....
...
and go on.
              Any ideas?
                      Mariusz Bozewicz

Instead of EXECUTE_SCRIPT you  should have something like:
LDLIBS = `gtk-config --libs`
CFLAGS = `gtk-config --cflags`

and when compiling "model" use LDLIBS and in all the other CFLAGS.
"gtk-config --cflags" is the include directories needed to compile a gtk
app, and "gtk-config --libs" is the libraries needed to link the binary.

Beñat




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




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