gpt4 book ai didi

Delphi 5 IDE 命令行返回代码

转载 作者:行者123 更新时间:2023-12-02 04:33:50 25 4
gpt4 key购买 nike

我正在尝试使用 MSBuild 脚本自动执行一些遗留的 Delphi 5 构建,但在捕获错误时遇到了困难。考虑到 MSBuild 传递存在一些问题,我还尝试了一个批处理文件,但当构建失败 (1) 时,我仍然收到回传 (0)。 %2 是 delphi 的路径,%3 是项目名称。

REM delphi_ide_build.bat
@ECHO OFF
"%1 %2\Bin\delphi32.exe" %3.dpr -b

REM BCB5 returns 0 if build succeeds, 1 if build fails
IF ERRORLEVEL 1 GOTO FAIL
IF ERRORLEVEL 0 GOTO PASS

:FAIL
ECHO An Error Occured in Build - Showing Log
ECHO ---------------------------------------
type %3.err
EXIT 1

:PASS
ECHO The Build Passed - Showing Log
ECHO ------------------------------
type %3.err
EXIT 0

根据在线帮助:

The Error Level is set to 0 for successful builds and 1 for failed builds.

目前我的项目失败(在日志文件中可见),但我的批处理文件运行成功。

[Fatal Error] MyFile.pas(43): File not found: 'aa.dcu'

这是 Delphi 5 中的错误,还是我遗漏了什么?

<小时/>

delphi32.exe 上选项 -B 的完整 IDE 帮助文本:

AutoBuild. Must be used with the filename option. When specified, the project or project group is built automatically when the IDE starts. Any hints, errors, or warnings are then saved to a file. Then the IDE exits. This facilitates doing builds in batch mode from a batch file. The Error Level is set to 0 for successful builds and 1 for failed builds. By default, the output file has the same name as the filename specified with the file extension changed to .err. This can be overridden using the o option

最佳答案

唯一的帮助是指命令行编译器 dcc32.exe,而不是 IDE。

用 dcc32.exe 替换 delphi32.exe 应该可以解决您的问题。

关于Delphi 5 IDE 命令行返回代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1805537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com