0

The editor automatically adds the System.Actions unit when one of my forms is saved.

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'

What am I missing?

Tom Brunberg
  • 20,312
  • 8
  • 37
  • 54
  • Did you save the project (and perhaps close it too) before you tried Command Line Compiler? What are the **exact** steps to reproduce the problem? – Tom Brunberg Oct 07 '16 at 09:59
  • How are you invoking the command-line compiler? Directly running dcc32 (or some other variant), in which case you'll need to pass in a whole boatload of command-line options to ensure the right dependent units are found, or by running MSBuild against the project in an appropriate RAD Studio Command Prompt for the version of the product used to edit the project? If the latter, all the relevant paths and command-line options should get set up appropriately. – blong Oct 07 '16 at 10:03
  • We are using dcc32 from another delphi program. What do you mean with "a whole boatload of command-line options to ensure the right dependent units are found"? Can you give an example? – Tomas Lundin Oct 07 '16 at 20:05
  • Don't. Use msbuild. – David Heffernan Oct 07 '16 at 20:09

2 Answers2

3

In what follows, I am assuming that you are using msbuild to compile your program.

The System.Actions unit was added in XE3 to support actions in both FMX and VCL frameworks. Prior to that release FMX had no actions. 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.

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. Most likely through the PATH environment variable, and whatever Embarcadero entry happens to be first in that variable.

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:

  • Remove all Embarcadero entries from your PATH environment variable.
  • 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.

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. 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.

Instead, use msbuild to build your program. That way you can use the settings defined in your project file.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
0

Thanks Hefferman for your advice but we shall stick with dcc32. It's easier to customize. For example we didn't figure out how to use more than one 'define' parameter with msbuild. It's possible to use dcc32 with the -NS switch for dependent 'uses' and that is our solution. We also create some .dpr files with code and in that case we do not have a corresponding .dproj file.