[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


Defining Symbols For Pascal

Although the Pascal preprocessor is not as powerful as the C/C++ preprocessor, you can still create files that can automatically insert your own preprocessor symbols and compiler directives into your project.

1. Create a new text file.

Open your project and create a new text file with the New Text File command.

This new text file will contain your compiler directives.

2. Open the Pascal Compiler settings panel.

Choose Target Settings from the Edit Menu. The actual name of the Target Settings command includes the name of the current build target. Select the Pascal Language settings panel in the Target Settings window.

3. Get the Prefix File name if it exists.

If there is a file name in the Prefix File field, Copy it, then close the Target Settings window.

In the new text file window, paste the file name that you copied from the Prefix File field into an include directive, {$I}. Make sure this is the first directive in the file.

For example, if the prefix file is OtherDefs.p, then the first directive in the editor window is:


  {$I OtherDefs.p}

4. Type in all your own {$SETC}, {$I}, and other preprocessor directives.

The text file cannot contain any source code that generates data or executable code.

5. Save the text file.

Save the file as an ordinary Pascal file in the same folder as your project. For example, save the file with "MyPrecomp.pas" as its name.

6. Precompile the text file.

Choose Precompile from the Project Menu. The IDE uses the text file to create a precompiled header file.

7. Open the Pascal Compiler settings panel.

Choose Target Settings from the Edit Menu, and select the Pascal Language settings panel.

8. Set the new Prefix File.

In the Prefix File field, enter the name of your file, in this example "MyPrecomp", then click Save to save your changes.

Whenever CodeWarrior builds your project, the project manager automatically includes the precompiled header in each source code file.


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000