GNU Linker problem with Dapper

Jhair Tocancipa Triana jhair.tocancipa at gmail.com
Sun Apr 30 08:41:23 UTC 2006


Arjun Shankar writes:

> I've been using Dapper for some time now, but never written code till
> now. And today, just as I started learning about libnet, I hit a
> roadblock.

> I have gcc, g++ versions 4.0 and 3.4 installed, along with libnet1 and
> libnet1-dev, all installed through apt (synaptic actually :)).

> However when I try to compile any programs with libnet, each instance
> of a libnet function in the code gives me this kind of error:

>> Terminal Output Begins
> spectre at TheHotChilipepper:~$ gcc-3.4 libnet_learn_1.c
> /tmp/ccmaIgZz.o: In function `main':libnet_learn_1.c:(.text+0x39):
> undefined reference to `libnet_init'
> :libnet_learn_1.c:(.text+0x4d): undefined reference to `libnet_destroy'
> collect2: ld returned 1 exit status
>> Terminal Output Ends

> /usr/include/libnet.h and the /usr/include/libnet directories _are_ there.

For the linker the header files are irrelevant at the point the error
message is issued.

> Whats wrong then? Never seen this happen in Fedora (my last distro)
> or elsewhere.

gcc -lnet libnet_learn_1.c
    ^^^^^

-- 
--Jhair





More information about the ubuntu-users mailing list