NSIS GetParent 函数抛出未知错误

NSIS GetParent functon throws an unknown error

在我的 NSIS 安装程序脚本中,我尝试使用 FileFunc.nsh 中定义的 GetParent 宏,但我得到一个奇怪的错误。有人知道为什么吗?

这是我的脚本代码

!include "FileFunc.nsh"

Section
   ${GetParent} "$INSTDIR" $parentDir
SectionEnd

我得到的错误是:

!insertmacro: GetParentCall
Usage: Pop $(user_var: output)
Error in macro GetParentCall on macroline 5

我正在使用 NSIS 2.46

$parentDir变量还没有声明,试试:

!include "FileFunc.nsh"
Var parentDir    

Section
   ${GetParent} "$INSTDIR" $parentDir
SectionEnd

只有 $0..$9、$R0..$R9 和少数其他($instdir 等)记录变量默认存在。