Glib linking error: undefined reference to ...



Hi,

I am not sure if this is the correct way of asking my question, but I nevertheless hope someone can help me... I just tried to solve the problem for 4 hours, and I am extremely frustrated right now... I have the following issue:

I installed Ubuntu 11.10 and some libraries and packages afterwards. I then installed glib 2.30. Everything went fine, I got no errors when doing ./configure, make, or make install. However, when I try to compile a test file in C, I can compile without errors, but I get the following errors:

glibTest.c:24: undefined reference to `g_timer_new'
glibTest.c:32: undefined reference to `g_random_double'
glibTest.c:36: undefined reference to `g_timer_stop'
glibTest.c:55: undefined reference to `g_str_hash'
...

I compile with:
"gcc `pkg-config --cflags --libs glib-2.0` -g3 -O2 -std=c99 -Wall -pedantic glibTest.c -o glibTest

pkg-config --cflags --libs glib-2.0 gives me:
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -L/usr/local/lib -lglib-2.0

This all worked on my old laptop with Ubuntu 10.04, and I have no idea what the issue is. I tried to install glib 2.28 and the newest 2.31 version, with the same error messages. I am no real expert, so please try to help me and let me know as precisely as possible how I can address the issue, I would greatly appreciate it.

Thanks,
Christian


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