|
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.
- Create new project (for example fpc_test).
- 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):
- 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.
- 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:
- 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.
- Double click on the target to execute it.
- Add a new target to project (using
button) with the name myunit.ppu and type - Free Pascal unit.
- 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).
- Edit new source:
unit myunit;
interface
procedure my_proc;
implementation
procedure my_proc;
begin
writeln('Simple unit.');
end;
end.
- Edit the source of main program so it looks like this:
uses myunit;
begin
writeln('Main program.');
my_proc;
end.
-
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:
-
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.
|