錯誤處理--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