Inno Setup-Pascal代码可见性-“未知标识符"错误 [英] Inno Setup - Pascal code visibility - "Unknown identifier" error
问题描述
我的安装程序中有一个文件,该文件带有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.
如何使SaveValueToXML
对UpdateImageLoaderConfigValues
可见?
推荐答案
您必须在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屋!