无法找出错误
我正在尝试让 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'
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'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您没有显示的代码有这样一行:
这意味着您显示的代码被编译器视为如下:
当然,它不会编译。
The code you don't show has this line:
This means that the code you did show is seen by the compiler as this:
which, of course, won't compile.
错误应该在其他地方,也许在以前的标题中?
您发布的代码编译没有问题: http://ideone.com/Wf64q
The mistake should be somewhere else, maybe in a previous header?
The code you posted compiles without problems: http://ideone.com/Wf64q
您的标识符与其他地方定义的某些宏名称冲突。您可能已经包含了一些已定义具有此类名称的宏的 Windows 头文件。
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.