Le mercredi 18 août 2010 à 10:26 +0300, Juhana Sadeharju a écrit : > What CFLAGS and LIBS I should use in Makefiles? > I installed GTK2 to home directory, and thus I won't use lddconfig. > My programs should take all from ~/gtk2/, and nothing from > /usr/include/gtk-1.2/ and nothing gtk-related from /usr/lib/. > > GTK2 does not have gtk-config program. It made things easier > in gtk1.2: > > CC=gcc -O2 -Wall > CFLAGS = `gtk-config --cflags` > LIBS= `gtk-config --libs` -lm -ljpeg -lpng > > Is there away to get all CFLAGS and LIBS by checking the pkgconfig file? > ~/gtk2/lib/pkgconfig/gtk+-2.0.pc CFLAGS=`PKG_CONFIG_PATH=~/gtk2/lib/pkgconfig:$PKG_CONFIG_PATH pkg-config --cflags gtk+-2.0` LIBS=`PKG_CONFIG_PATH=~/gtk2/lib/pkgconfig:$PKG_CONFIG_PATH pkg-config --libs gtk+-2.0` (you might have to replace ~ by the real path) hope this helps, regards, Jean > > I have now the following in Makefile. Very messy. It does not work; > I get errors: undefined reference to `gtk_text_view_new' and the like. > > CC=gcc -O2 -Wall > CFLAGS= -I/home/juhana/gtk2/include/glib-2.0 -I/home/juhana/gtk2/include/gtk-2.0 -I/home/juhana/gtk2/lib/glib-2.0/include -I/home/juhana/gtk2/include/cairo -I/home/juhana/gtk2/include/pango-1.0 -I/home/juhana/gtk2/lib/gtk-2.0/include -I/home/juhana/gtk2/include/atk-1.0 > LIBS= -L/home/juhana/gtk2/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm -ljpeg -lpng > > O_ESPBROWSER=mylib/filesdirs.o mylib/buffer.o mylib/image.o mylib/gsl_taus.o mylib/clock.o mylib/mmapfile.o mylib/sprint.o mylib/arrays.o espbrowser.o > > all:: espbrowser > > espbrowser: $(O_ESPBROWSER) > $(CC) $(CFLAGS) -o espbrowser $(O_ESPBROWSER) $(LIBS) > > > I use this include command in the C code: > #include "/home/juhana/gtk2/include/gtk-2.0/gtk/gtk.h" > I'm afraid it won't help because gtk.h uses > #include <gdk/gdk.h> > which may be "/usr/include/gtk-1.2/gdk/gdk.h". > > > How the linked ld works? My programs are simple. Perhaps I could > write a script to compile and link everything explicitly. But this > include file business worries me still. > > This is so frustating. I will return to GTK 1.2 soon. > First Ubuntu failed to install GTK2, and now this! > > I could start writing my programs under demos/gtk-demo/ and compile > the demo. But then I don't understand how to add my mylib/mmapfile.o > etc. files to the configure system. :-( > > Help needed. > > _______________________________________________ > gtk-list mailing list > gtk-list@xxxxxxxxx > http://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list