Re: [gnome-love] newbie question on compiling a glib program



On 4/1/07, Santanu Chatterjee <thisissantanu gmail com> wrote:
Hello Everybody,

I was trying to teach myself GNOME programming
(using The Official GNOME 2.0 Developer's Guide)
I wrote the following program:
-------------------------------------------------------------
#include <glib.h>

int main(int argc, char *argv[])
{
        GQuark test_quark;

        test_quark = g_quark_from_string("Santanu");
        if(!q_quark_try_string("Chatterjee")){
                g_print("There is no quark for \"Chatterjee\"\n");
        }
        g_print("test_quark is a representation of %s\n",
q_quark_to_string(test_quark));

        return (0);
}
--------------------------------------------------------------
(Please note that the indentation might get garbled in the
email)

Then I tried to compile it using:
$ gcc `pkg-config --clibs --libs glib-2.0` tryglib.c -o tryglib

But I get this:
---------------------------
/tmp/ccwz8ywE.o: In function `main':
tryglib.c:(.text+0x38): undefined reference to `q_quark_try_string'
tryglib.c:(.text+0x5a): undefined reference to `q_quark_to_string'
collect2: ld returned 1 exit status
---------------------------

What could I have done wrong? I have checked the
glibc manual using devhelp, and verified that those
two functions exist.

Just to prevent future confusion, glibc and glib are two different
things.  glib is the general-purpose utility library used by GNOME and
GTK+, glibc is the GNU implementation of the C standard library. :)

--
jonner



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