在linux中使用IPTC库添加iptables规则的代码未链接

在linux中使用IPTC库添加iptables规则的代码未链接,c,linux,linker,iptables,iptc,C,Linux,Linker,Iptables,Iptc,我试图编译这里提供的示例C代码 按照帖子中的描述使用: cc `pkg-config –cflags –libs libiptc` iptablesExample_2.c -o iptablesExample_2 我还尝试使用以下方法编译它: sudo gcc -g -o iptablesExample_2 iptablesExample_2.c -liptc -liptables -ldl 它也不起作用,这次的错误是: /usr/bin/ld: cannot find -liptables

我试图编译这里提供的示例C代码

按照帖子中的描述使用:

cc `pkg-config –cflags –libs libiptc` iptablesExample_2.c -o iptablesExample_2
我还尝试使用以下方法编译它:

sudo gcc -g -o iptablesExample_2 iptablesExample_2.c -liptc -liptables -ldl
它也不起作用,这次的错误是:

/usr/bin/ld: cannot find -liptables   
collect2: ld returned 1 exit status
我还尝试了本文末尾提供的示例 我也有同样的问题

Linux内核:3.8.2 iptables版本:v1.4.12


在命令行上运行pkg config–cflags–libs libiptc的输出是什么?libiptables来自哪里?它在编译时没有链接器选项-liptables吗?谢谢,问题已经解决了。我使用sudo gcc-g-o iptablesExample iptablesExample.c-liptc-lip4tc-lip6tc-ldl编译了它。您可能想为自己的问题添加一个答案,也可以接受is答案。这样可以检测到您的问题是否已被回答。