# Delph XE2 Error E2158

**URL:** https://www.finalbuilder.com/forums/t/delph-xe2-error-e2158/1856
**Category:** Discussion
**Created:** [September 14, 2011, 11:29am UTC](https://www.finalbuilder.com/forums/t/delph-xe2-error-e2158/1856 "2011-09-14T11:29:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![keppelverolme](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/ba8739/32.png) [@keppelverolme](https://www.finalbuilder.com/forums/u/keppelverolme)
#### Post date: [September 14, 2011, 11:29am UTC](https://www.finalbuilder.com/forums/t/delph-xe2-error-e2158/1856/1 "2011-09-14T11:29:25Z")

</div>

&nbsp;When I compile my projects in FB&nbsp;with Delphi XE2 &nbsp;I get these error message for some of my projects&nbsp;

c:\program files (x86)\embarcadero\rad studio\9.0\SOURCE\RTL\SYS\System.Variants.pas(960) Fatal: E2158 System.Variants unit out of date or corrupted: missing '@VarCast'

or&nbsp;

&nbsp;

c:\program files (x86)\embarcadero\rad studio\9.0\source\data\bde\BDE.pas(4897) Fatal: E2226 Compilation terminated; too many errors

or&nbsp;

KGsMenuService\_Impl.pas(16) Fatal: F1026 File not found: 'ExtCtrls.dcu'

&nbsp;

&nbsp;

I used the global Lib and use build with packages

my projects compiles ok in Delphi XE2

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [September 14, 2011, 11:51am UTC](https://www.finalbuilder.com/forums/t/delph-xe2-error-e2158/1856/2 "2011-09-14T11:51:30Z")

</div>

Why do you have the RTL/VCL Source code in your library path ? Your library paths should be pointing at the lib folders, this is what I have :   
  
 c:\program files (x86)\embarcadero\rad studio\9.0\lib\Win32\release;C:\Users\Anne\Documents\RAD Studio\9.0\Imports;c:\program files (x86)\embarcadero\rad studio\9.0\Imports;C:\Users\Public\Documents\RAD Studio\9.0\Dcp;c:\program files (x86)\embarcadero\rad studio\9.0\include   
  
 The global library paths that we use are pulled from the registry, which suggests that you have added the delph rtl/vcli source folders to your library path. If you are doing that then they must all be before any lib folders (and it’s not recommended unless you know what you are doing).

---

<div class="post-metadata">

### Author: ![keppelverolme](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/ba8739/32.png) [@keppelverolme](https://www.finalbuilder.com/forums/u/keppelverolme)
#### Post date: [September 15, 2011, 12:05pm UTC](https://www.finalbuilder.com/forums/t/delph-xe2-error-e2158/1856/3 "2011-09-15T12:05:40Z")

</div>

&nbsp;In my library path Ihave&nbsp;

$(work)\$(Config)\$(Ver);c:\program files (x86)\embarcadero\rad studio\9.0\lib\Win32\release;\\filer1\user\u068181\Documents\RAD Studio\9.0\Imports;c:\program files (x86)\embarcadero\rad studio\9.0\Imports;C:\Users\Public\Documents\RAD Studio\9.0\Dcp;c:\program files (x86)\embarcadero\rad studio\9.0\include;C:\Program Files (x86)\FastReports\LibD16;c:\program files (x86)\embarcadero\rad studio\9.0\RaveReports\Lib;

and the libraries to our 3rd party components

In my search path I have&nbsp;

$(work)\$(Config)\$(Ver);$(BDS)\SOURCE\VCL;$(BDS)\source\rtl\common;$(BDS)\SOURCE\RTL\SYS;$(BDS)\source\rtl\win;$(BDS)\source\ToolsAPI;$(BDS)\SOURCE\IBX;$(BDS)\source\Internet;$(BDS)\SOURCE\PROPERTY EDITORS;$(BDS)\source\soap;$(BDS)\SOURCE\XML;$(BDS)\source\db;$(BDS)\source\Indy10\Core;$(BDS)\source\Indy10\System;$(BDS)\source\Indy10\Protocols;$(BDS)\source\fmx;$(BDS)\source\databinding\components;$(BDS)\source\databinding\engine;$(BDS)\source\databinding\graph;$(BDS)\source\fmi;$(BDS)\source\data;$(BDS)\source\data\ado;$(BDS)\source\data\bde;$(BDS)\source\data\cloud;$(BDS)\source\data\datasnap;$(BDS)\source\data\dbx;$(BDS)\source\data\dsnap;$(BDS)\source\data\Test;$(BDS)\source\data\vclctrls;C:\Program Files (x86)\FastReports\LibD16;

and sources to our 3rd party components

&nbsp;

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [September 15, 2011, 1:27am UTC](https://www.finalbuilder.com/forums/t/delph-xe2-error-e2158/1856/4 "2011-09-15T01:27:22Z")

</div>

> In my search path I have   
>   
> \>$(work)$(Config)$(Ver);$(BDS)\SOURCE\VCL;$(BDS)\source\rtl\common;   
>   
> Why? Why are you compiling the Delphi RTL/VCL library source code?   
>   
> In any event, on the Directories Page, make sure you have the correct FrameWork Type selected, Delphi XE uses Namespace prefixes to differentiate between the different frameworks it uses.

---

<div class="post-metadata">

### Author: ![keppelverolme](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/k/ba8739/32.png) [@keppelverolme](https://www.finalbuilder.com/forums/u/keppelverolme)
#### Post date: [September 15, 2011, 3:03am UTC](https://www.finalbuilder.com/forums/t/delph-xe2-error-e2158/1856/5 "2011-09-15T03:03:03Z")

</div>

&nbsp;Thanks a lot for your suggestions.&nbsp;

I changed the searchpath (removed all the BDS stuff) and that did the trick for most errors.

I also forgotten for some delphi actions to set the framework correctly so that took care of the rest of the problems

&nbsp;

Thanks again&nbsp;
