NSIS:尽管预处理器收到未知警告 variable/constant "test" 检测到
NSIS: Despite preproccsor get warning unknown variable/constant "test" detected
如果设置了标志,我只使用一些代码。所以我收到警告
Variable "test" not referenced or never set, wasting memory!
所以我使用预处理器命令
!if ${Flag} == 1
Var test
!endif
但我仍然收到警告
unknown variable/constant "test" detected, ignoring (macro:_==:1)
那么为什么我仍然收到警告以及如何禁用警告:
也许我可以使用 !pragma
来禁用警告。但这仅适用于 nsis3
。我在 nsis2
可以做什么?
你很可能把你的 !if
守卫搞砸了 $test
。
!define Flag 1
!if ${Flag} == 1
Var test
!endif
如果您从未在 Section
/Function
.
中访问 $test
,则将打印 Variable "test" not referenced or never set, wasting memory!
另一方面
Section
${If} $test == "something"
${EndIf}
SectionEnd
如果代码没有首先执行 Var test
,将打印 unknown variable/constant "test" detected, ignoring (macro:_==:1)
。
最后
Var test
Section
${If} $test == "something"
${EndIf}
SectionEnd
也会出于某种原因打印 Variable "test" not referenced or never set, wasting memory!
但如果你在代码中的某处实际分配了一些东西给 $test
警告就会消失:
Var test
Function .onInit
StrCpy $test ""
FunctionEnd
Section
${If} $test == "something"
${EndIf}
SectionEnd
如果设置了标志,我只使用一些代码。所以我收到警告
Variable "test" not referenced or never set, wasting memory!
所以我使用预处理器命令
!if ${Flag} == 1
Var test
!endif
但我仍然收到警告
unknown variable/constant "test" detected, ignoring (macro:_==:1)
那么为什么我仍然收到警告以及如何禁用警告:
也许我可以使用 !pragma
来禁用警告。但这仅适用于 nsis3
。我在 nsis2
可以做什么?
你很可能把你的 !if
守卫搞砸了 $test
。
!define Flag 1
!if ${Flag} == 1
Var test
!endif
如果您从未在 Section
/Function
.
$test
,则将打印 Variable "test" not referenced or never set, wasting memory!
另一方面
Section
${If} $test == "something"
${EndIf}
SectionEnd
如果代码没有首先执行 Var test
,将打印 unknown variable/constant "test" detected, ignoring (macro:_==:1)
。
最后
Var test
Section
${If} $test == "something"
${EndIf}
SectionEnd
也会出于某种原因打印 Variable "test" not referenced or never set, wasting memory!
但如果你在代码中的某处实际分配了一些东西给 $test
警告就会消失:
Var test
Function .onInit
StrCpy $test ""
FunctionEnd
Section
${If} $test == "something"
${EndIf}
SectionEnd