Inno Setup-Pascal代码可见性-“未知标识符"错误 [英] Inno Setup - Pascal code visibility - "Unknown identifier" error

查看:131
本文介绍了Inno Setup-Pascal代码可见性-“未知标识符"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a file in my installer with an AfterInstall action like so:

AfterInstall: UpdateImageLoaderConfigValues()

我想让程序两次调用同一个Pascal Script函数,因为据我所知,我不能同时执行两个AfterInstall操作,所以我将其设置为:

And I would like the procedure to call the same Pascal Script function twice as I can't have two AfterInstall actions as far as I am aware, so I have set this up like so:

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);

问题在于编译失败是由于

The problem is that compilation fails because of

未知标识符'SaveValueToXML'

Unknown identifier 'SaveValueToXML'

我尝试使用此功能的UpdateImageLoaderConfigValues点出现错误.

error at the points in UpdateImageLoaderConfigValues where I am trying to use this function.

如何使SaveValueToXMLUpdateImageLoaderConfigValues可见?

推荐答案

您必须在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;

这篇关于Inno Setup-Pascal代码可见性-“未知标识符"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆