Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8965003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:43:01+00:00 2026-06-15T16:43:01+00:00

I have various define statements for handling different Delphi versions in an include file.

  • 0

I have various define statements for handling different Delphi versions in an include file. This include file is “included” in an unit. The compiler respects the defines given in the include file but the IDE not. This results in an addition of certain units to the uses clause which are can be already there – enclosed in a DEFINE compiler directive.

Therefore, if a unit is added which isn’t available in pre Delphi XE3 you will have a big problem because if you let the IDE add the unit and can not compile it with a pre Delphi XE3 version which doesn’t have that unit.

E.g. a project with one unit with an TActionList on it.

  1. MYINCLUDE.INC only one define {$DEFINE DELPHIXE3}

  2. A sample unit may look like

    unit Unit1;
    
    {$I MYINCLUDE.INC}                
    
    uses
       Winapi.Windows, 
       Winapi.Messages, 
       System.SysUtils, 
       System.Variants, 
       System.Classes, 
       Vcl.Graphics,
       Vcl.Controls, 
       Vcl.Forms, 
       Vcl.Dialogs,
       {$IFDEF DELPHIXE3} System.Actions, {$ENDIF}
       Vcl.ActnList;
      ...
    
  3. After a save the IDE adds System.Actions add the end of the uses list which in turn results in an Identifier redeclared compiler error. If you delete it the IDE will add it again the next save.

I have just reported that to QC #111178.

Is there a workaround for that bug?

Christian

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:43:02+00:00Added an answer on June 15, 2026 at 4:43 pm

    Probably the easiest thing to do is to use the unit alias feature to help. In order for this to work you need different project settings for different compiler versions. For example, different .dpr and .dproj files for each supported compiler version.

    In your XE2 project you define a unit alias like so:

    System.Actions=Vcl.ActnList
    

    In the XE3 project you omit that alias.

    Then in your .pas file you can happily use System.Actions with no problems in either version of Delphi.

    An even simpler solution is to create an empty unit named System.Actions that you only include in your project for XE2 builds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program which has various unit conversions defined in a configuration file
I have various time-series I'd like to correlate and present as either a csv-file
I have various settings in my ccnet.config file and wish to pass them to
Suppose I have #define foo in various header files. It may expand to some
I have an RCP application that uses extension points to defined various pluggable bits
I have various class which perform save and update operations of GUI elements, it
I have various pieces of generated HTML/JS that I load into Activity with WebView#loadDataWithBaseURL.
We have various related session variables for a complex page that has various things
I have various HTML strings to cut to 100 characters (of the stripped content,
I have various models of which I would like to keep track and collect

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.