[英]Visual Studio 2013 DEBUG preprocessor directive always defined
[英]Preprocessor directive #error: 'DEBUG is defined'
我在文件中的第一行是:
#define DEBUG
在我的程序中,我將此變量用作:
#region Preprocessor directives
#if DEBUG
#error DEBUG is defined
#endif
#endregion
編譯時出現以下錯誤: #error:'已定義DEBUG' 。
我有誤會嗎?
正如我在評論中已經指出的那樣,這正是“ #error”預處理程序指令的意圖。 MSDN上的說明說:
#error
可讓您從代碼中的特定位置生成錯誤。
請參見MSDN上的此處: https : //msdn.microsoft.com/zh-cn/library/x5hedts0.aspx
因此,在您的情況下,您的指令告訴預處理器顯示錯誤, DEBUG is defined
在設置DEBUG
符號時DEBUG is defined
了DEBUG
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.