简体   繁体   English

错误:F1026找不到文件:命令行编译器'System.Actions.dcu'

[英]Error: F1026 File not found: 'System.Actions.dcu' by Command Line Compiler

The editor automatically adds the System.Actions unit when one of my forms is saved. 保存我的表单之一时,编辑器会自动添加System.Actions单元。

It compiles without a problem in the IDE, but unfortunately the Command Line Compiler can not find the file and gives me the error: Error: F1026 File not found: 'System.Actions.dcu' 它可以在IDE中正常编译,但是很遗憾,命令行编译器找不到该文件,并给了我错误: Error: F1026 File not found: 'System.Actions.dcu'

What am I missing? 我想念什么?

In what follows, I am assuming that you are using msbuild to compile your program. 在下面的内容中,我假设您正在使用msbuild编译程序。

The System.Actions unit was added in XE3 to support actions in both FMX and VCL frameworks. XE3中添加了System.Actions单元,以支持FMX和VCL框架中的操作。 Prior to that release FMX had no actions. 在该版本之前,FMX没有任何操作。 Some classes were moved around, out of VCL units and into the new System.Actions unit which can be used by both FMX and VCL code. 一些类从VCL单元移到了新的System.Actions单元,FMX和VCL代码都可以使用。

So, the compiler error that you see suggests to me that you are unintentionally compiling with a version that pre-dates this change. 因此,您看到的编译器错误提示我,您无意中使用的版本早于此更改。 My guess is that your IDE is XE3 or later, but that your command line build is configured to use an earlier version of Delphi. 我的猜测是您的IDE是XE3或更高版本,但是您的命令行版本已配置为使用早期版本的Delphi。 Most likely through the PATH environment variable, and whatever Embarcadero entry happens to be first in that variable. 最有可能通过PATH环境变量,而Embarcadero条目恰好在该变量中排在首位。

If my hunch is correct then you need to ensure that you compile with the desired version. 如果我的想法是正确的,那么您需要确保使用所需的版本进行编译。

The way I organise machines that have multiple Delphi installations is as follows: 我组织具有多个Delphi安装的计算机的方式如下:

  • Remove all Embarcadero entries from your PATH environment variable. PATH环境变量中删除所有Embarcadero条目。
  • Whenever you need to build at the command line, configure the environment, for instance by running the appropriate rsvars.bat script (found in the bin directory of your Delphi installation) before you call msbuild . 每当您需要在命令行上进行构建时,例如,在调用msbuild之前,通过运行相应的rsvars.bat脚本(在Delphi安装的bin目录中找到)来配置环境。

This way you cannot accidentally find the wrong version because you have to explicitly configure an environment. 这样,您就不会偶然发现错误的版本,因为您必须显式配置环境。


On the other hand, perhaps you are calling dcc32 directly. 另一方面,也许您正在直接调用dcc32。 Don't do that. 不要那样做 You will have to supply all the options and paths that are already defined in your project file. 您将必须提供项目文件中已定义的所有选项和路径。 Repeating that is just a way to create a maintenence headache and make it likely that your command line build won't match the IDE build. 重复此操作只是造成维护麻烦的一种方法,并可能导致您的命令行版本与IDE版本不匹配。

Instead, use msbuild to build your program. 而是使用msbuild生成程序。 That way you can use the settings defined in your project file. 这样,您可以使用项目文件中定义的设置。

Thanks Hefferman for your advice but we shall stick with dcc32. 感谢Hefferman的建议,但我们会坚持使用dcc32。 It's easier to customize. 自定义更容易。 For example we didn't figure out how to use more than one 'define' parameter with msbuild. 例如,我们没有弄清楚如何在msbuild中使用多个“ define”参数。 It's possible to use dcc32 with the -NS switch for dependent 'uses' and that is our solution. 可以将dcc32与-NS开关一起使用以进行相关的“用途”,这就是我们的解决方案。 We also create some .dpr files with code and in that case we do not have a corresponding .dproj file. 我们还使用代码创建了一些.dpr文件,在这种情况下,我们没有相应的.dproj文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM