Discussion:
Problems compiling app using libnet 1.1.2.1
Johan Akerstrom
2004-09-30 13:17:41 UTC
Permalink
Hi,

Before I start I will just want to state that I am new to libnet and I
am not much of a C programmer (Java man) .

I wrote a tiny libnet (hello world type) app for libnet version 1.0.?.?
(Whatever version that came with my SuSE box) which compiled and worked
fine. Now I would like to use libnet 1.1.2.1 which I got from
http://www.packetfactory.net/libnet/dist/libnet.tar.gz.

I did a "find -name libnet*" at filesystem root and I deleted all old
libnet files from the drive. I downloaded the libnet tar ball and then
I ran ./configure make and make install.

This is the tine piece of code I'm trying to compile;
$ cat lnd.c
#include <libnet.h>
#include <stdio.h>

int main(int argc, char **argv){
int c;
char errbuf[LIBNET_ERRBUF_SIZE];
libnet_t *l = NULL;
l = libnet_init(LIBNET_LINK,NULL,errbuf);
c = libnet_write(l);
return 0;
}

I tried to compile my new app with
"gcc `libnet-config --defines` `libnet-config --libs` `libnet-config
--cflags` -o test lnd.c"

Which gave me the following error message:
/tmp/ccna0Gqu.o(.text+0x2c): In function `main':
: undefined reference to `libnet_init'
/tmp/ccna0Gqu.o(.text+0x43): In function `main':
: undefined reference to `libnet_write'
collect2: ld returned 1 exit status

I guess that this is because of some version mismatch but I can't
resolve it... ...so please help me resolve this.
So I ran "strings /usr/lib/libnet.a |grep version" and this is the
result;
libnet_version.o/
libnet version 1.1.2.1 (c) 1998 - 2004 Mike D. Schiffman <mike
infonexus com>
libnet_version.c

...which for me looks like I am coding for the right version.

Regards Johan



**********************************************************************
Please note: The e-mail accompanying this disclaimer is confidential and may also be privileged.
Please notify us immediately if you are not the intended recipient. You should not copy it, forward it, or use it for any purpose or disclose the contents to any person.

This email has been swept for viruses using tools from our preferred suppliers. Telamon Systems actively supply both mail-scanning and anti-virus products in addition to supplying a range of security, infrastructure and business solutions to our customers.

For further details please see our web site at www.telamon.co.uk, email ***@telamon.co.uk or call our sales team on +44 (0)870 607 4747
**********************************************************************
Loading...