I'm trying to get google glog to work开发者_开发技巧 with windows, but I get these errors that I can't figure out.
// 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'
The code you don't show has this line:
#define INFO 0
This means that the code you did show is seen by the compiler as this:
const int 0 = 0;
which, of course, won't compile.
The mistake should be somewhere else, maybe in a previous header?
The code you posted compiles without problems: http://ideone.com/Wf64q
Your identifiers are conflicting with some macro names defined somewhere else. You have probably included some Windows header file that already defines a macro with such name.
精彩评论