错误处理--pure specifier can only be specified for functions


错误处理--pure specifier can only be specified for functions

今天下载了log4cpp的源代码,在VC6下编译时出现错误:

..\..\include\log4cpp/Priority.hh(65) : error C2258: illegal pure syntax, must be '= 0'
..\..\include\log4cpp/Priority.hh(65) : error C2252: 'MESSAGE_SIZE' : pure specifier can only be specified for functions
..\..\include\log4cpp/threading/MSThreads.hh(160) : fatal error C1506: unrecoverable block scoping error

出错的代码位于Priority.hh中,代码为:

static const int MESSAGE_SIZE = 8;

这个错误改起来很简单,只要将这行代码改为:

static const int MESSAGE_SIZE;

然后定位到Priority.cpp文件中,添加以下的代码即可:

const int Priority::MESSAGE_SIZE = 8;

注意一下,如果这行代码没有放在namespace中时,需要在加上namespace,如:

const int log4cpp::Priority::MESSAGE_SIZE = 8;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM