redhat6编译log4cxx

redhat6版本编译很多软件都会语法检查太严,导致编译通不过。log4cxx就是其中之一,不过都是头文件缺失引起的错误,补充头文件即可,我把我安装时碰到的问题写出来,希望有人碰到类似的问题,不用走弯路,高手就飘过吧。

安装log4cxx之前需检查如下包是否安装,

下载当前最新版本

wget http://mirror.bjtu.edu.cn/apache/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz

解压安装

./configure --prefix=/usr/server/log4xx

make

很快就可以看到报错,如图

'memmove' was not declared in this scope

缺少string.h这个头文件,如果是低版本会自动补上来,修改src/main/include/log4cxx/helpers/inputstream.h添加如下

继续make,不需要make clean之类的操作,再次报错,内容如下。

'memcpy' was not declared in this scope

同样,修改src/main/include/log4cxx/helpers/socketoutputstream.h添加#include<string.h>头文件,不上图了

继续make,应该到如下报错

console.cpp:58: error: ‘puts’ was not declared in this scope
console.cpp:63: error: ‘strcmp’ was not declared in this scope
console.cpp:66: error: ‘stderr’ was not declared in this scope
console.cpp:66: error: ‘stdout’ was not declared in this scope
console.cpp:66: error: ‘fputs’ was not declared in this scope
console.cpp:69: error: ‘stderr’ was not declared in this scope
console.cpp:69: error: ‘stdout’ was not declared in this scope
console.cpp:102: error: ‘stderr’ was not declared in this scope
console.cpp:102: error: ‘stdout’ was not declared in this scope
console.cpp:104: error: ‘stderr’ was not declared in this scope
console.cpp:104: error: ‘stdout’ was not declared in this scope
console.cpp:107: error: ‘stderr’ was not declared in this scope
console.cpp:107: error: ‘fputs’ was not declared in this scope
console.cpp:110: error: ‘fflush’ was not declared in this scope

修改src/examples/cpp/console.cpp,添加二行

如果不添加string.h后面还会有报错(error: ‘strcmp’ was not declared in this scope)

修改完成后,再次make,就没有问题了,最后再执行make install,就编译安装成功了。

转载于:https://my.oschina.net/beiyou/blog/76387

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值