gpt4 book ai didi

delphi - 是否有 DCC32 选项将特定编译器警告视为错误?

转载 作者:行者123 更新时间:2023-12-03 14:41:50 25 4
gpt4 key购买 nike

对于命令行构建,我想将警告(例如“构造包含抽象方法的实例”)视为错误。我在 Delphi 2009 中没有找到用于此目的的 dcc32 命令行选项。有没有办法(例如使用 dcc32.cfg)来执行此操作?

最佳答案

像这样:

dcc32 -W^^CONSTRUCTING_ABSTRACT MyProject.dpr

例如,使用此程序:

program MyProject;

type
TMyClass = class
procedure X; virtual; abstract;
end;

begin
TMyClass.Create;
end.

这是输出:

>dcc32 MyProject.dprEmbarcadero Delphi for Win32 compiler version 24.0Copyright (c) 1983,2012 Embarcadero Technologies, Inc.Myproject.dpr(9) Warning: W1020 Constructing instance of 'TMyClass' containing abstract method 'TMyClass.X'Myproject.dpr(12)13 lines, 0.03 seconds, 21568 bytes code, 13256 bytes data.>dcc32 -W^^CONSTRUCTING_ABSTRACT MyProject.dprEmbarcadero Delphi for Win32 compiler version 24.0Copyright (c) 1983,2012 Embarcadero Technologies, Inc.Myproject.dpr(9) Error: E1020 Constructing instance of 'TMyClass' containing abstract method 'TMyClass.X'Myproject.dpr(12)

If you want all warnings to be treated as errors then you do it like this:

dcc32 -W^^ MyProject.dpr

如需进一步阅读,请参阅 Delphi XE2's hidden hints and warnings options .

关于delphi - 是否有 DCC32 选项将特定编译器警告视为错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15383471/

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