Sign in Join
FPDoc Onlineexperiment

Testing the compiler

After the installation is completed and the optional environment variables are set as described above, your first program can be compiled.

Included in the Free Pascaldistribution are some demonstration programs, showing what the compiler can do. You can test if the compiler functions correctly by trying to compile these programs.

The compiler is called

  • fpc.exe under Windows, OS/2and DOS.

  • fpc under most other operating systems.

To compile a program (e.g demo\text\hello.pp), copy the program to your current working directory, and simply type :

  fpc hello

at the command prompt. If you don’t have a configuration file, then you may need to tell the compiler where it can find the units, for instance as follows:

fpc -Fuc:\pp\NNN\units\i386-go32v2\rtl hello

under DOS, and under Linuxyou could type

fpc -Fu/usr/lib/fpc/NNN/units/i386-linux/rtl hello

(replace NNN with the version number of Free Pascalthat you are using). This is, of course, assuming that you installed under C:\PP or /usr/lib/fpc/NNN, respectively.

If you got no error messages, the compiler has generated an executable called hello.exe under DOS, OS/2or Windows, or hello (no extension) under Unixand most other operating systems.

To execute the program, simply type :

  hello

or

  ./hello

on Unices (where the current directory usually is not in the PATH).

If all went well, you should see the following friendly greeting:

Hello world

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.