error at link ( build ) the project (glib)

Ulrich Eckhardt doomster at knuut.de
Thu Feb 8 06:42:41 GMT 2007


On Wednesday 07 February 2007 02:51, Agra wrote:
> #include <node.h>
>
> GList *node_move_detector_to_front (GList *list, GList
> *this_list)
> {
> 	list = g_list_remove_link (list, this_list);
> 	return g_list_concat (this_list, list);
> }
> ------------------------------------------------------
>
> and in file node.h :
> #include <glib.h>
>
> GList *node_move_detector_to_front (GList *list, GList
> *this_list);
> ------------------------------------------------------
>
> When I compiled it, kdevelop doest give me any error
> message
>
> node.o(.text+0x721): In function
> `node_move_detector_to_front':
> /root/tata/aisnids/src/node.c:389: undefined reference
> to `g_list_remove_link'
> node.o(.text+0x735):/root/tata/aisnids/src/node.c:390:
> undefined reference to `g_list_concat'

You need to link with glib so you need something like '-lglib' (I guess that's 
its name) on the commandline. You can also enter it in the project settings 
of Kdevelop. Otherwise, this error has not too much to do with kdevelop but 
is rather a 'normal' C errror.

> I've tried to include the glib.h from Automake Manager
> and tried both, the link and copy option, but I still
> get the same error.

C (and C++) are slightly broken IMHO in that they require you to #include a 
header and further to link to the according library. You only did one thing 
and got linker errors because of that.

Uli





More information about the KDevelop mailing list