c++ - 无法弄清楚错误

标签 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'

最佳答案

显示的代码有这一行:

#define INFO 0

这意味着您显示的代码在编译器看来是这样的:

const int 0 = 0;

当然不会编译。

关于c++ - 无法弄清楚错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7363760/

相关文章:

c++ - int 数组中出现频率最低的公共(public)数

c++ - 如何使用 msvs 包含和设置 brian gladman aes?

C++ 和 pin 工具——非常奇怪的 IF 语句双变量问题

linux - 在 CentOS 6.5 上构建 Dart 的错误

spring - 无法在tomcat上部署spring项目

c++ - 将 char 指针数组传递给函数

c++ - 'L'之前缺少模板参数

c# - 编译错误 CS0029 无法将类型 'ComboBox.ObjectCollection' 隐式转换为 'CheckedListBox.ObjectCollection'

java - Log4j 隐式字符串格式化

python - 不显示 Tensorflow 日志消息