简体   繁体   English

无法找出错误

[英]Can't figure out error

I'm trying to get google glog to work with windows, but I get these errors that I can't figure out. 我正在尝试使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'

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 您发布的代码可以毫无问题地进行编译: 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. 您可能已经包含一些Windows头文件,该文件已经使用该名称定义了宏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM