* why I cann't compile the program?
@ 2003-11-25 1:41 Fangweiwei
2003-11-25 7:01 ` Sven Schuster
0 siblings, 1 reply; 2+ messages in thread
From: Fangweiwei @ 2003-11-25 1:41 UTC (permalink / raw)
To: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 2909 bytes --]
Hello everyone!
I try to compile the following code,but it gives some msg to show something wrong?what should I do ?
------------------------------------------
/*
* This code is GPL.
*/
#include <linux/netfilter.h>
#include <libipq.h>
#include <stdio.h>
#define BUFSIZE 2048
static void die(struct ipq_handle *h)
{
ipq_perror("passer");
ipq_destroy_handle(h);
exit(1);
}
int main(int argc, char **argv)
{
int status;
unsigned char buf[BUFSIZE];
struct ipq_handle *h;
h = ipq_create_handle(0, PF_INET);
if (!h)
die(h);
status = ipq_set_mode(h, IPQ_COPY_PACKET, BUFSIZE);
if (status < 0)
die(h);
do{
status = ipq_read(h, buf, BUFSIZE, 0);
if (status < 0)
die(h);
switch (ipq_message_type(buf)) {
case NLMSG_ERROR:
fprintf(stderr, "Received error message %d\n",
ipq_get_msgerr(buf));
break;
case IPQM_PACKET: {
ipq_packet_msg_t *m = ipq_get_packet(buf);
status = ipq_set_verdict(h, m->packet_id,
NF_ACCEPT, 0, NULL);
if (status < 0)
die(h);
break;
}
default:
fprintf(stderr, "Unknown message type!\n");
break;
}
} while (1);
ipq_destroy_handle(h);
return 0;
}
----------------------------------------------
I try to compile it using: gcc test.c
but it gives me some msg as following:
/tmp/ccYcdyBh.o: In function `die':
/tmp/ccYcdyBh.o(.text+0xf): undefined reference to `ipq_perror'
/tmp/ccYcdyBh.o(.text+0x1d): undefined reference to `ipq_destroy_handle'
/tmp/ccYcdyBh.o: In function `main':
/tmp/ccYcdyBh.o(.text+0x41): undefined reference to `ipq_create_handle'
/tmp/ccYcdyBh.o(.text+0x7b): undefined reference to `ipq_set_mode'
/tmp/ccYcdyBh.o(.text+0xb5): undefined reference to `ipq_read'
/tmp/ccYcdyBh.o(.text+0xe3): undefined reference to `ipq_message_type'
/tmp/ccYcdyBh.o(.text+0x12a): undefined reference to `ipq_get_msgerr'
/tmp/ccYcdyBh.o(.text+0x157): undefined reference to `ipq_get_packet'
/tmp/ccYcdyBh.o(.text+0x17e): undefined reference to `ipq_set_verdict'
collect2: ld returned 1 exit status
----------------------------------------------
can you help me? thanks a lot.
Fangweiwei
fangweiwei@tom.com
2003-11-25
[-- Attachment #2: fox.gif --]
[-- Type: image/gif, Size: 9519 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: why I cann't compile the program?
2003-11-25 1:41 why I cann't compile the program? Fangweiwei
@ 2003-11-25 7:01 ` Sven Schuster
0 siblings, 0 replies; 2+ messages in thread
From: Sven Schuster @ 2003-11-25 7:01 UTC (permalink / raw)
To: netfilter-devel
Hello,
Fangweiwei wrote:
>----------------------------------------------
>I try to compile it using: gcc test.c
>
>
try compiling it with
gcc -o test test.c -lipq
This will link it with the ipq library (which you of course must have
installed).
>but it gives me some msg as following:
>
>/tmp/ccYcdyBh.o: In function `die':
>/tmp/ccYcdyBh.o(.text+0xf): undefined reference to `ipq_perror'
>/tmp/ccYcdyBh.o(.text+0x1d): undefined reference to `ipq_destroy_handle'
>/tmp/ccYcdyBh.o: In function `main':
>/tmp/ccYcdyBh.o(.text+0x41): undefined reference to `ipq_create_handle'
>/tmp/ccYcdyBh.o(.text+0x7b): undefined reference to `ipq_set_mode'
>/tmp/ccYcdyBh.o(.text+0xb5): undefined reference to `ipq_read'
>/tmp/ccYcdyBh.o(.text+0xe3): undefined reference to `ipq_message_type'
>/tmp/ccYcdyBh.o(.text+0x12a): undefined reference to `ipq_get_msgerr'
>/tmp/ccYcdyBh.o(.text+0x157): undefined reference to `ipq_get_packet'
>/tmp/ccYcdyBh.o(.text+0x17e): undefined reference to `ipq_set_verdict'
>collect2: ld returned 1 exit status
>
>----------------------------------------------
>
>can you help me? thanks a lot.
>
> Fangweiwei
> fangweiwei@tom.com
> 2003-11-25
>
Sven
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-11-25 7:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-25 1:41 why I cann't compile the program? Fangweiwei
2003-11-25 7:01 ` Sven Schuster
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.