[英]Delphi {$INCLUDE filename} in uses part of dpr file
I have many Delphi 10 projects that are using the same units, let's call them "commons". 我有许多使用相同单元的Delphi 10项目,我们称它们为“常见”。
When I add anew unit to commons, I have to manually add it to each project. 当我向公共空间添加新单元时,必须手动将其添加到每个项目中。 I have tried adding a
{$INCLUDE commons.inc}
line into the uses
part of each .dpr
file: 我尝试将
{$INCLUDE commons.inc}
行添加到每个.dpr
文件的uses
部分中:
uses
Forms,
{$INCLUDE commons.inc}
projectUnit1,
...;
commons.inc
has this content: commons.inc
具有以下内容:
common1,
common2,
I can compile a project but cannot manage the units from commons.inc
. 我可以编译一个项目,但是不能管理
commons.inc
的单元。 By manage, I mean Ctrl-F12 , remove from project, etc. 通过管理,我的意思是Ctrl-F12 ,从项目中删除等。
This is from Delphi's help: 这是在Delphi的帮助下:
There is one restriction to the use of include files: an include file can't be specified in the middle of a statement part.
包含文件的使用有一个限制:不能在语句部分的中间指定一个包含文件。 In fact, all statements between the begin and end of a statement part must exist in the same source file.
实际上,语句部分开始和结束之间的所有语句必须存在于同一源文件中。
I suppose that is why my idea does not work? 我想这就是为什么我的想法行不通的原因?
Am I doing something wrong, or is there another solution? 我是在做错什么,还是有其他解决方案?
This workaround might suit. 此解决方法可能适合。 The only downside I have found so far is that the included files do not appear in the Project Manager.
到目前为止,我发现的唯一缺点是所包含的文件没有出现在项目管理器中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.