libiptc 例子 编译
2011-04-06 16:25
549 查看
参考 具体需要修改里面的代码,版本比较旧
http://tldp.org/HOWTO/Querying-libiptc-HOWTO/
下载iptables源代码,然后解压
./configure --prefix=/opt/iptables && make && make install
mkdir /opt/iptablesdev
cp -r include /opt/iptablesdev
cp -r /opt/iptables/lib /opt/iptablesdev
vim main.c
vim Makefile
test: main.o
g++ -o test main.o -L/opt/iptablesdev/lib -liptc
main.o: main.c
gcc -g -c main.c -I/opt/iptablesdev/include
export LD_LIBRARY_PATH=/opt/iptablesdev/lib
./test
http://tldp.org/HOWTO/Querying-libiptc-HOWTO/
下载iptables源代码,然后解压
./configure --prefix=/opt/iptables && make && make install
mkdir /opt/iptablesdev
cp -r include /opt/iptablesdev
cp -r /opt/iptables/lib /opt/iptablesdev
vim main.c
#include <getopt.h> #include <sys/errno.h> #include <stdio.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> #include <dlfcn.h> #include <time.h> #include "libiptc/libiptc.h" #include "iptables.h" int main(void) { struct iptc_handle *h; const char *chain = NULL; const char *tablename = "filter"; //program_name = "p1"; //program_version = "1.2.3"; h = iptc_init(tablename); if ( !h ) { printf("Error initializing: %s/n", iptc_strerror(errno)); exit(errno); } for (chain = iptc_first_chain(h); chain; chain = iptc_next_chain(h)) { printf("%s/n", chain); } exit(0); }
vim Makefile
test: main.o
g++ -o test main.o -L/opt/iptablesdev/lib -liptc
main.o: main.c
gcc -g -c main.c -I/opt/iptablesdev/include
export LD_LIBRARY_PATH=/opt/iptablesdev/lib
./test
相关文章推荐
- 编译jrtplib第一个例子
- 编译jrtplib第一个例子(转载)
- vs2010下用nmake编译libevent/sample中的例子
- VS2008编译DirectX SDK 2004 summer版的Sound例子程序出现的libcp.lib找不到的问题的解决办法
- 转:编译jrtplib第一个例子
- 编译jrtplib第一个例子
- lib_clapack.a(dlasyf.o): could not read symbols: File in wrong format---- 交叉编译opencv2.0遇到的错误解决
- php5编译无法生成 libphp5.so
- vs2005 编译 libpqxx2.6.9
- 如何正确编译servlet & 两个jre目录和三个lib目录
- 静态编译libcairo.a的时候遇到的依赖库的问题及解决方法
- 实时直播协议:编译RTMPdump(libRTMP)
- VS2010 编译QT 4.8.1 静态库(lib)
- 如何在ubuntu下编译dolphin-player所用的libffmpeg.so
- 我的Firefox插件开发之旅(5)——编译和测试第一个Plugin例子:npruntime
- 编译安装libfreenect2时错误问题
- alsa-lib,alsa-utils交叉编译步骤
- ubuntu下编译 jrtplib-3.9.1 和 jthread - 1.3.1
- windows下ffmpeg编译成lib、dll与使用ffmpeg制作播放器
- linux 编译安装TRMPdump(libRTMP)