arpd编译错误

本文解决arpd.c编译过程中的多个错误,包括预定义函数使用问题、未定义引用及共享库缺失等问题,并提供详细的修改步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题1:

编译 arpd.c 
arpd.c: In function ‘arpd_send’:
arpd.c:269: 错误:expected ‘)’ before string constant
arpd.c: In function ‘arpd_lookup’:
arpd.c:286: 错误:expected ‘)’ before string constant
arpd.c:295: 错误:expected ‘)’ before string constant
arpd.c:298: 错误:expected ‘)’ before string constant
arpd.c: In function ‘arpd_recv_cb’:
arpd.c:427: 错误:expected ‘)’ before string constant
gmake: *** [arpd.o] 错误 1
*** 退出状态:2 ***

解决方法:
    在arpd.c文件首部加上#define __FUNCTION__ “”语句

原因分析:
syslog(LOG_DEBUG, __FUNCTION__ ": no entry for %s",addr_ntoa(addr));函数中常量__FUNCTION__为预定义,该函数是操作系统中的库函数,你可以在/usr/include/sys/中找到syslog.h头文件中有它的定义,具体定义如下:
extern void syslog (int __pri, __const char *__fmt, ...)
     __attribute__ ((__format__ (__printf__, 2, 3)));

问题2:

arpd.o: In function `terminate_handler':
arpd.c:(.text+0x1556): undefined reference to `event_gotsig'
arpd.o: In function `main':
arpd.c:(.text+0x17bf): undefined reference to `event_sigcb'
collect2: ld returned 1 exit status
make: *** [arpd] Error 1

解决方法:

删除或注释掉arpd.c文件的448、450、467、468、527行,即下列行:

448:// extern int event_gotsig;

450:// event_gotsig = 1;

468://extern int (*event_sigcb)(void);

527://event_sigcb = arpd_signal;

 

 

 

问题3:
[root@ lib]# ./arpd/arpd 
./arpd/arpd: error while loading shared libraries: libevent-.so.2: cannot open shared object file: No such file or directory

解决方法:
方法一:直接把libevent-so.2文件拷贝到系统指定的/usr/lib库文件目录中。
方法二:设置/etc/ld.so.conf文件,编辑该文件,在文件中加入libevent-so.2所在的目录,保存后退出。需要注意的是,每次改动ld.so.conf之后需要运行ldconfing来确认刷新。

转载于:https://www.cnblogs.com/swordzj/archive/2013/05/25/3098637.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值