【问题标题】:Inno Setup - Pascal code visibility - "Unknown identifier" errorInno Setup - Pascal 代码可见性 - “未知标识符”错误
【发布时间】:2016-04-12 08:03:35
【问题描述】:

我的安装程序中有一个带有AfterInstall 操作的文件,如下所示:

AfterInstall: UpdateImageLoaderConfigValues()

并且我希望该过程调用相同的 Pascal 脚本函数两次,因为据我所知,我不能有两个 AfterInstall 操作,所以我已经这样设置了:

procedure UpdateImageLoaderConfigValues();
begin
  SaveValueToXML(ExpandConstant('{app}\ImageLoader.exe.config'),{#ImageLoaderLastConfigurationPath}, ExpandConstant('{app}/Configurations'))
  SaveValueToXML(ExpandConstant('{app}\ImageLoader.exe.config'),{#ImageLoaderLastImagePath}, ExpandConstant('{app}/Images'))
end;

我的函数SaveValueToXML 有一个签名:

function SaveValueToXML(const AFileName, APath, AValue: string);

问题是编译失败是因为

未知标识符“SaveValueToXML”

UpdateImageLoaderConfigValues 中我尝试使用此功能的点出错。

如何使SaveValueToXMLUpdateImageLoaderConfigValues 可见?

【问题讨论】:

    标签: inno-setup pascalscript


    【解决方案1】:

    你必须在UpdateImageLoaderConfigValues之前定义SaveValueToXML

    [Files]
    Source: ...; AfterInstall: UpdateImageLoaderConfigValues()
    
    [Code]
    
    function SaveValueToXML(const AFileName, APath, AValue: string);
    begin
      { ... }
    end;
    
    procedure UpdateImageLoaderConfigValues();
    begin
      SaveValueToXML(ExpandConstant('{app}\ImageLoader.exe.config'),{#ImageLoaderLastConfigurationPath}, ExpandConstant('{app}/Configurations'))
      SaveValueToXML(ExpandConstant('{app}\ImageLoader.exe.config'),{#ImageLoaderLastImagePath}, ExpandConstant('{app}/Images'))
    end;
    

    对于其他人,他们带着同样的错误信息到达这里,但在变量标识符上,而不是在 functionprocedure 调用上,请参阅 Inno Setup Pascal script problem... "Unknown Identifier"

    【讨论】:

      猜你喜欢
      • 2016-06-23
      • 1970-01-01
      • 1970-01-01
      • 2021-08-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多