9

After install Delphi XE2, I try command line compiler dcc32.exe to compile a simple program:

program test;

uses SysUtils;

begin
end.

The command line compiler show me error:

c:> dcc32.exe test.dpr
Embarcadero Delphi for Win32 compiler version 23.0 Copyright (c) 1983,2011 Embarcadero Technologies, Inc.
test.dpr(3) Fatal: F1026 File not found: 'SysUtils.dcu'

This doesn't happen to Delphi XE.

ain
  • 22,394
  • 3
  • 54
  • 74
Chau Chee Yang
  • 18,422
  • 16
  • 68
  • 132

4 Answers4

30

If you just want to use the command line (without dcc32.cfg), the command line parameter you are looking for is -NS to specify the namespaces to search in...

So, you would have something like this:

dcc32.exe -NSsystem;vcl test.dpr

This should make the compiler look for units in the System and VCL namespaces (VCL added to show how to append more than one namespace).

This information was found on the Embarcadero Discussion Forums. I don't yet have XE2 so I couldn't test it.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Nat
  • 5,414
  • 26
  • 38
13

Due to the new namespaces in the RTL and VCL you have to specify an additional command line parameter to the compiler. Try "-NSSystem;System.Win;WinAPI;Vcl;Vcl.Imaging;Data" and add other namespaces as needed.

Uwe Raabe
  • 45,288
  • 3
  • 82
  • 130
9

I know it's not the answer to your direct question (Uwe and Nat have that covered), but you would be much better off building with msbuild. That way you'll pick up all the settings in your .dproj file.

The build command should look like this:

msbuild test.dproj /t:Rebuild /p:Config=Release

If you are building this from a batch script, you'll need to make sure it can see the right msbuild. Do it like this:

call "path\to\delphi\installation\bin\rsvars.bat"
msbuild test.dproj /t:Rebuild /p:Config=Release
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • 1
    How do you create the dproj? I assume since he compiles on the cmdline he didn't want to start Delphi for it. – Marco van de Voort Sep 07 '11 at 09:16
  • 1
    @Marco The .dproj is part of the source code in recent delphi versions. It is maintained by the IDE and contains your project configurations. – David Heffernan Sep 07 '11 at 09:23
  • 1
    I don't understand your point. It is for a standard (GUI) project certainly, but for ordinary cases you don't go back to the cmdline. – Marco van de Voort Sep 07 '11 at 10:32
  • 1
    @Marco the msbuild approach still calls dcc32, but it works out the command line options for you based on the configuration in the .dproj file. If you decide to drive dcc32 yourself then you will have to maintain to parallel config options and keep them in synch. That's a recipe for errors. It's best practice to avoid duplication and the errors that inevitably result from that. Hence msbuild. – David Heffernan Sep 07 '11 at 10:36
  • 1
    I'm perfectly aware how the dproj-msbuild system works. And my point is that somebody who asks about a cmdline application probably never opens the project in Delphi in the first place. – Marco van de Voort Sep 07 '11 at 19:45
  • 3
    @Marco Hardly. It's commonplace to use the IDE for some tasks and command line for other tasks. They aren't mutually exclusive. – David Heffernan Sep 07 '11 at 19:46
  • 1
    I simply assume that if sb asks a cmdline question he wants a commandline answer. This is my last comment on the subject. – Marco van de Voort Sep 07 '11 at 19:55
  • This is the way to go if you have a .dproj file for sure! msbuild can even handle Delphi/CPPBuilder groupproj files – Totte Karlsson Dec 26 '20 at 23:28
-1

If you are using an Hewlett Packard PC or Laptop, you will probably need to remove the "Platform" environment setting (in windows). The Pre-configured (factory) HP windows7 has (for reasons unknown to me) an environment variable Platform=AnyCPU. This affects Delphi XE2. I found this discussion last night, which helped me: https://forums.embarcadero.com/thread.jspa?messageID=387525&tstart=0 Without that fix, I was unable to compile ANYTHING. It would choke on VCL and FireMonkey, didn't matter if I targeted 64 or 32-bit.

Chris Thornton
  • 15,620
  • 5
  • 37
  • 62
  • That only applies when compiling .dproj files, not .dpr files, which do not have Platform specifications in them. – Remy Lebeau Sep 07 '11 at 18:23