★ wanayoo — archive 1999 http://codeforge.com/tutorials/FPCTutorial.htmlNouvelle recherche | Portail wanayoo
C-Forge home


To use the Free Pascal Compiler in C-Forge to compile your Pascal programs you must download and install properly the Free Pascal Compiler from it's home.

  1. Create new project (for example fpc_test).
  2. Enter new target name (fpc_test) ant set target Type to Free Pascal executable (make sure that the Use Directory Layout option is turned off - it is not supported for Free Pascal):

  3. Move the selection cursor to the newly created target in Dependency Tree and press "Add source" button - .

    When the File Selection dialog appears, press the "New file" button.

    Enter the name of main program (for example test.pp) and press "OK" button.

  4. Drag'n'Drop the source file test.pp from Dependency Tree into the Working Area and enter the following text in the Editor Window:
    begin
       writeln('Main program.');
    end.
    

    Your project should now look like this:

  5. Save the file in the editor, move the selection cursor to target fpc_test and press "Make target" button - , or drag the target into the Build drop-site.
  6. Double click on the target to execute it.
  7. Add a new target to project (using button) with the name myunit.ppu and type - Free Pascal unit.
  8. Add a new source to newly created target.
    Note: The name of source for unit must be the same as basename of unit with extention .pp, in this case - myunit.pp).
  9. Edit new source:
    unit myunit;
    
    interface
    
    procedure my_proc;
    
    implementation
    
    procedure my_proc;
    begin
       writeln('Simple unit.');
    end;
    
    end.
    
  10. Edit the source of main program so it looks like this:
    uses myunit;
    begin
       writeln('Main program.');
       my_proc;
    end.
    
  11. Now, link unit to the end of dependency list of main target. To do this Ctrl-Shift drag the icon of target myunit.ppu to the icon of target fpc_text. Your project should now look like this:

  12. Double click on target fpc_test to run it. The target and its components will be build automatically before execution if any of their elements are not up-to-date.

 

 


Copyright © Code Forge, Inc. 1997-99. All rights reserved.


Last modified: Thursday, 30-Sep-1999 02:13:12 MDT