到sourceforge的log4cpp项目的主页上下载
下面是网址
http://log4cpp.sourceforge.net/
2、解压到特定目录
3、编译
log4cpp-0.3.5rc3/msvc6/msvc6.dsw
出现
d:/log4cpp-0.3.5rc3/include/log4cpp/priority.hh(65) : error C2258: illegal pure syntax, must be '= 0'
d:/log4cpp-0.3.5rc3/include/log4cpp/priority.hh(65) : error C2252: 'MESSAGE_SIZE' : pure specifier can only be specified for functions
d:/log4cpp-0.3.5rc3/include/log4cpp/threading/msthreads.hh(160) : fatal error C1506: unrecoverable block scoping error
错误提示
解决方法:
出错位置priority.hh
class LOG4CPP_EXPORT Priority {
public:
static const int MESSAGE_SIZE=8;
/ Some other declarations //
};
解决方法
将代码改成
static const int MESSAGE_SIZE;
在priority.cpp 里加一句
#include "PortabilityImpl.hh"
#include
#include
const int log4cpp::Priority::MESSAGE_SIZE=8;
保存重新编译
如果出现*.pch不要rebuild整个工程。单独选中一个工程build就可以了。
生成的结果有静态库,也有动态库,根据自己的需要使用。