对于命令行构建,我想治疗警告(例如,“构建实例含有抽象方法”)为错误。 我还没有发现用于此目的的德尔福2009年。dcc32命令行选项使用DCC32.CFG文件,要做到这一点是有办法,例如?
Answer 1:
像这样:
dcc32 -W^^CONSTRUCTING_ABSTRACT MyProject.dpr
例如,用此程序:
program MyProject;
type
TMyClass = class
procedure X; virtual; abstract;
end;
begin
TMyClass.Create;
end.
而这里的输出:
>dcc32 MyProject.dpr Embarcadero Delphi for Win32 compiler version 24.0 Copyright (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.dpr Embarcadero Delphi for Win32 compiler version 24.0 Copyright (c) 1983,2012 Embarcadero Technologies, Inc. Myproject.dpr(9) Error: E1020 Constructing instance of 'TMyClass' containing abstract method 'TMyClass.X' Myproject.dpr(12)
如果你想将所有警告视为错误,那么你做这样的:
dcc32 -W^^ MyProject.dpr
对于进一步的阅读我是指你德尔福XE2隐藏的提示和警告选项 。
文章来源: Is there a DCC32 option to treat a specific compiler warning as an error?