无法弄清楚错误

时间:2011-09-09 15:11:41

标签: c++ compiler-errors logging

我正试图让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'

3 个答案:

答案 0 :(得分:2)

显示的代码包含以下内容:

#define INFO 0

这意味着您所显示的代码被编译器视为:

const int 0 = 0;

当然不会编译。

答案 1 :(得分:1)

错误应该在其他地方,可能在之前的标题中?

您发布的代码编译没有问题:http://ideone.com/Wf64q

答案 2 :(得分:0)

您的标识符与其他位置定义的某些宏名称冲突。您可能已经包含了一些已经定义了具有此名称的宏的Windows头文件。