Re: Updated to Ubuntu 11.04 and Can't Compile



On Sat, 5 Mar 2011, Craig Bakalian wrote:

I am still at it.  It is a lonely night here.  My kids are playing with
legos, and I am baffled by this.  I have run pkg-config to no avail.  I
have examined my packages and include files.  It is all there.  The
error appears to be in ld.  Isn't ld a linker?  Here is the terminal out
on an attempt to compile, notice the ld returned 1 exit status at the
end->

craig craig:~$ cc `pkg-config --cflags --libs gtk+-2.0` hello.c -o hello
/tmp/ccfg4t6z.o: In function `main':
hello.c:(.text+0x17): undefined reference to `gtk_init'

At the shell prompt (in a terminal window), try

pkg-config --libs gtk+-2.0

What does it say? It should say something like

allin myrtle:~$ pkg-config --libs gtk+-2.0
-pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0
-lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lcairo
-lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0
-lgthread-2.0 -lrt -lglib-2.0

So are the libraries actually there?

ls -al /usr/lib/libgtk-x11-2.0*

There should be a symlink, something like

/usr/lib/libgtk-x11-2.0.so -> libgtk-x11-2.0.so.0.2000.1

(version numbers may differ). If not, you need to (re-)install
libgtk2.0-dev at least.

Allin Cottrell



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