我试图让 google glog 与 windows 一起工作,但我遇到了这些我无法弄清楚的错误。
// Variables of type LogSeverity are widely taken to lie in the range
// [0, NUM_SEVERITIES-1]. Be careful to preserve this assumption if
// you ever need to change their values or add a new severity.
typedef int LogSeverity;
const int INFO = 0;
const int WARNING = 1;
const int ERROR = 2;
const int FATAL = 3;
const int NUM_SEVERITIES = 4;
1>c:\users\<me>\documents\visual studio 2008\projects\sampleproj\sampleproj\src\windows\glog\log_severity.h(53) : warning C4091: '' : ignored on left of 'const int' when no variable is declared
1>c:\users\<me>\documents\visual studio 2008\projects\sampleproj\sampleproj\src\windows\glog\log_severity.h(53) : error C2143: syntax error : missing ';' before 'constant'
1>c:\users\<me>\documents\visual studio 2008\projects\sampleproj\sampleproj\src\windows\glog\log_severity.h(53) : error C2059: syntax error : 'constant'
最佳答案
您不显示的代码有这一行:
#define INFO 0
这意味着您显示的代码在编译器看来是这样的:
const int 0 = 0;
当然不会编译。
关于c++ - 无法弄清楚错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7363760/