【发布时间】:2011-09-09 15:11:40
【问题描述】:
我正在尝试让 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'
【问题讨论】:
-
错误出现在您未向我们展示的程序部分。请提供一个最小的、完整的程序来演示错误。有关为什么这很重要以及如何做到这一点的信息,请参阅sscce.org。
-
问题中提供的代码很好。您可能在
typedef int LogSeverity;行之前的某处缺少分号。查看log_severity.h和log_severity.h包含的所有文件中的typedef之前是否缺少分号。 -
我正在处理一个基本的 Windows 项目(只是写 hello world),但你一定是对的。我创建了一个空项目,它似乎工作。奇数。
标签: c++ compiler-errors logging