title: Delphi compile error F2048 Bad unit format
body: <p>I ran into an obscure error and am posting the solution here in the hope that it will help someone else having the same problem.</p>
  
  <p>I am writing a Continuous Integration (CI) program using Delphi XE4 to ensure that a set of pascal source files will compile under older versions of Delphi.  This CI program runs a series of batch files each running the command line compiler of an older Delphi version.  The batch file running the XE compiler produced the following error:</p>
  
  <blockquote>
    <p>F2048 Bad unit format: 'c:\program files (x86)\embarcadero\rad studio\11.0\lib\Win32\release\System.dcu' - Expected version: 22.0 ... Found version: 25.0</p>
  </blockquote>
  
  <p>Note that the expected and found versions are different (in this case XE and XE4).  Several people have reported similar errors where the expected and found versions were the same - this is usually a mixup between 32 and 64 bit DCUs, but that wasn't the problem here.</p>
  
  <p>This problem only occurs when the CI program is run from within the Delphi XE4 IDE.  If the CI program is run outside of the IDE it works fine.</p>