无法找出错误

发布于 2024-12-03 22:35:56 字数 974 浏览 0 评论 0原文

我正在尝试让 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

穿透光 2024-12-10 22:35:56

没有显示的代码有这样一行:

#define INFO 0

这意味着您显示的代码被编译器视为如下:

const int 0 = 0;

当然,它不会编译。

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.

不乱于心 2024-12-10 22:35:56

错误应该在其他地方,也许在以前的标题中?

您发布的代码编译没有问题: 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

半透明的墙 2024-12-10 22:35:56

您的标识符与其他地方定义的某些宏名称冲突。您可能已经包含了一些已定义具有此类名称的宏的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文