![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CIM implementations | Godofredo | UNIX and Linux Applications | 0 | 03-25-2008 06:06 AM |
| Creating a Hash Table | callmetheskull | High Level Programming | 4 | 12-23-2007 12:17 PM |
| MD5 hash filename | bebar | Shell Programming and Scripting | 1 | 10-26-2007 10:44 AM |
| Creating a hash table using shell script | jyotipg | UNIX for Advanced & Expert Users | 2 | 10-29-2003 02:37 AM |
| How can i load or insert a table in oracle from c language thru unix environment | rramprasad | High Level Programming | 6 | 07-08-2002 09:17 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#8
|
|||
|
|||
|
compilation problems with glib
Hello vino ,
i have the program # cat glibtest.c Code:
#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;
}
# 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 I think still iam missing some libraires .. please advise me thanks |
| Forum Sponsor | ||
|
|
|
#9
|
||||
|
||||
|
Try adding the libglib-2.0 library.
Code:
gcc -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g glibtest.c -o glibtest.o -lglib-2.0 |
|
#10
|
|||
|
|||
|
The glib-config utility can make this a lot simpler.
Code:
$ glib-config --cflags -I/usr/include/glib-1.2 -I/usr/lib/glib/include $ glib-config --libs -L/usr/lib -lglib $ Code:
gcc `glib-config --cflags` -g glibtest.c -o glibtest `glib-config --libs` |
|
#11
|
|||
|
|||
|
hashtable lib on freshmeat
|
|
#12
|
|||
|
|||
|
freshmeat
lists a hashtable library in C with ref counting:
http://freshmeat.net/projects/sunrisedd/ |
|||
| Google The UNIX and Linux Forums |