In file included from /usr/include/glib-2.0/glib/galloca.h:30,
from /usr/include/glib-2.0/glib.h:30,
from glibtest.c:2:
/usr/include/glib-2.0/glib/gtypes.h:30:24: glibconfig.h: No such file or directory
In file included from /usr/include/glib-2.0/glib/galloca.h:30,
from /usr/include/glib-2.0/glib.h:30,
from glibtest.c:2:
#include <stdio.h>
#include <glib.h>
int main(){
GHashTable *hash = g_hash_table_new(g_int_hash, g_int_equal);
g_hash_table_insert(hash,"Virginia","Richmond");
printf(" %s ",g_hash_table_lookup(hash,"Virginia"));
gboolean found = g_hash_table_remove(hash,"Virginia");
printf("The Value 'virginia' was %s found and removed \n",found ? "":"not");
g_hash_table_destory(hash);
return 0;
}
the compilation problems are
# gcc -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g glibtest.c -o glibtest.o
/tmp/ccElT30B.o(.text+0x20): In function `main':
/home/ramakanth/cprogs/hashprogs/glibtest.c:6: undefined reference to `g_int_equal'
/tmp/ccElT30B.o(.text+0x25):/home/ramakanth/cprogs/hashprogs/glibtest.c:6: undefined reference to `g_int_hash'
/tmp/ccElT30B.o(.text+0x2a):/home/ramakanth/cprogs/hashprogs/glibtest.c:6: undefined reference to `g_hash_table_new'
/tmp/ccElT30B.o(.text+0x45):/home/ramakanth/cprogs/hashprogs/glibtest.c:7: undefined reference to `g_hash_table_insert'
/tmp/ccElT30B.o(.text+0x58):/home/ramakanth/cprogs/hashprogs/glibtest.c:9: undefined reference to `g_hash_table_lookup'
/tmp/ccElT30B.o(.text+0x79):/home/ramakanth/cprogs/hashprogs/glibtest.c:10: undefined reference to `g_hash_table_remove'
/tmp/ccElT30B.o(.text+0xb3):/home/ramakanth/cprogs/hashprogs/glibtest.c:12: undefined reference to `g_hash_table_destory'
collect2: ld returned 1 exit status