GHashTable broken in glib1.1.11?




I have tried and failed to get GHashTable to work under glib1.1.11
(Slackware 3.6).  Any ideas?

#include <stdio.h>
#include <string.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
#include <glib.h>

#include "tiger.h"

guint
hash_pass(gconstpointer key)
{
 return (guint) *(((struct passwd *)key)->pw_name);
}

gint
hash_pass_compare(gconstpointer a, gconstpointer b)
{
 return !strcmp(((struct passwd *) a)->pw_name,((struct passwd *)b)->pw_name);
}

GHashTable* hash_table;
hash_table = (GHashTable *)g_hash_table_new(hash_pass,hash_pass_compare);

...

$ cc -o tiger tiger.c -I/usr/lib/glib/include -lglib
tiger.c:33: conflicting types for `hash_table'
tiger.c:31: previous declaration of `hash_table'
tiger.c:33: warning: initialization makes integer from pointer without a cast
tiger.c:33: initializer element is not constant
tiger.c:33: warning: data definition has no type or storage class
make: *** [tiger] Error 1
$ 


-- 
David Nicklay _________ Ventura  O-
     \  /_ .__|_   .__.  o|| _ 
      \/(/_| ||_|_||(_|\/|||(/_ 
    http://www.avana.net/~ventura/



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