Re: an easy question, I assume



Brendan,

I would suggest using pkg-config to handle your compile flags.  It saves
a lot of headeaches.

In the case of the software you are trying to compile you could do
something like:

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

And that will fill in all of the required flags for you.

Maybe that helps.

Alan

On Wed, 2003-04-16 at 15:32, brendan cs uchicago edu wrote:
> I have this little program:
> 
> #include <gtk/gtk.h>
> #include <stdio.h>
> 
> int
> main ()
> {
>  return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version));
> }
> 
> which I am having trouble getting to compile. This is from a configure
> in a Gnome package which I am having trouble compiling from source. The
> prefix gtk is installed under on my system is /opt/gtk/gtk+-2.2.0
> 
> This is what my compile line looks like:
> 
> gcc \
> -I/opt/glib/glib-2.2.1/include/glib-2.0 \
> -I/opt/glib/glib-2.2.1/lib/glib-2.0/include \
> -L/opt/glib/glib-2.2.1/lib \
> -I/opt/gtk/gtk+-2.2.0/include/gtk-2.0 \
> -I/opt/gtk/gtk+-2.2.0/lib/gtk-2.0/include \
> -L/opt/gtk/gtk+-2.2.0/lib \
> -I/opt/pango/pango-1.2.0/include/pango-1.0 \
> -I/opt/atk/atk-1.2.0/include/atk-1.0 \
> test.c
> 
> Just for good measure I have the following set as well, just for
> testing:
> 
> LD_LIBRARY_PATH=/opt/glib/glib-2.2.1/lib:/opt/gtk/gtk+-2.2.0/lib:/opt/atk/atk-1.2.0/lib:/opt/pango/pango-1.2.0/lib
> LD_RUN_PATH=/opt/glib/glib-2.2.1/lib:/opt/gtk/gtk+-2.2.0/lib:/opt/atk/atk-1.2.0/lib:/opt/pango/pango-1.2.0/lib
> 
> All these variable are exported. It seems to be finding all the
> headers, etc.
> 
> However:
> 
> /tmp/ccAnxjir.o: In function `main':
> /tmp/ccAnxjir.o(.text+0x7): undefined reference to `gtk_major_version'
> /tmp/ccAnxjir.o(.text+0x10): undefined reference to `gtk_minor_version'
> /tmp/ccAnxjir.o(.text+0x19): undefined reference to `gtk_micro_version'
> collect2: ld returned 1 exit status
> 
> And:
> 
> $ pwd
> /opt/gtk/gtk+-2.2.0/lib
> $ for i in *; do echo $i; nm $i | egrep '(gtk_major_version|gtk_minor_version|gtk_micro_version)'; done
> ...
> libgtk-x11-2.0.so
> 0027e3a0 R gtk_major_version
> 0027e3a8 R gtk_micro_version
> 0027e3a4 R gtk_minor_version
> libgtk-x11-2.0.so.0
> 0027e3a0 R gtk_major_version
> 0027e3a8 R gtk_micro_version
> 0027e3a4 R gtk_minor_version
> libgtk-x11-2.0.so.0.200.0
> 0027e3a0 R gtk_major_version
> 0027e3a8 R gtk_micro_version
> 0027e3a4 R gtk_minor_version
> ...
> 
> These are all the same file, with libgtk-x11-2.0.so.0.200.0 being the
> actual binary. So the libraries that contain these symbols are in the
> runtime linker's search path. (In this case, with LD_LIBRARY_PATH).
> 
> I know this has got to be something really simple...
> 
> Any ideas?
> 
> Thanks,
> Brendan
> _______________________________________________
> gnome-list mailing list
> gnome-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-list
-- 
Alan Johnson <alan txtger net>




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