簡體   English   中英

無法找出錯誤

[英]Can't figure out error

我正在嘗試使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;

當然,它不會編譯。

錯誤應該在其他地方,也許在先前的標頭中?

您發布的代碼可以毫無問題地進行編譯: http : //ideone.com/Wf64q

您的標識符與其他地方定義的某些宏名稱沖突。 您可能已經包含一些Windows頭文件,該文件已經使用該名稱定義了宏。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM