redhat6编译log4cxx

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

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

redhat6编译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

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

redhat6编译log4cxx

'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,添加二行

redhat6编译log4cxx

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

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

你可能感兴趣的:(编译log4cxx,log4cxx编译报错,log4cxx报错)