Pascal programming language is one of the commonly used language for beginners in programming. It is because Pascal has simple, structured, and clean syntax, especially when compared to that of C++.
Linux is a good operating system for competitive programmers and application developers. Personally, I always use Ubuntu, a famous Linux distribution, to create programs. The good news is that Free Pascal is included in Ubuntu repository as the standard Pascal compiler.
Here is how I install and optimize Free Pascal in Ubuntu.
Installing Compiler and IDE
Free Pascal compiler is included in Ubuntu repository as fp-compiler package. Therefore, to install the compiler, you have to install fp-compiler, by running this command in a terminal.
$ sudo apt-get install fp-compiler
Type your root password and wait until the installation finishes. You are now able to compile Pascal source code files (.pas), for example, by running
$ fpc file.pas
to compile a source code named file.pas in the current directory.
You can create Pascal files in any text editors. However, if you prefer to develop with Free Pascal IDE (integrated development environment), you can install the fp-ide package.
$ sudo apt-get install fp-ide
To launch the IDE, run
Your terminal will turn into the legendary Free Pascal’s blue editor. You may receive a Debian bug warning depending on your Ubuntu version, but you can simply ignore it.
Integrating into GNOME Menu
Because Free Pascal is a terminal-based program, it is not available in GNOME menu. However, you can easily add a launcher menu to it. Here is how I add Free Pascal to GNOME menu.
- Right-click GNOME menu (usually located on the upper right corner of your screen), and then click Edit Menus.
- Select Programming submenu.
- Click New Item.
- Enter these details:
- Type: Application
- Name: Free Pascal
gnome-terminal --title="Free Pascal" --geometry=80x40 --hide-menubar -e fp
- Click OK.
Done! Now you can run Free Pascal IDE by selecting Applications -> Programming -> Free Pascal from GNOME menu. You don’t have to run it manually from the terminal again.
By default, Free Pascal documentation is not included in the previous installations. You can add it by installing fp-docs package.
$ sudo apt-get install fp-docs
The documentation files will be added to /usr/share/doc/fp-docs. It can be integrated into Free Pascal IDE, by following these steps.
- Select Help -> Files….
- Click New.
- Select the file /usr/share/doc/fp-docs/fpctoc.html.
- Click Open.
- Wait for the indexing to finish.
After that, the documentation will be available under the menu Help.
Enjoy coding or developing Pascal programs in Ubuntu!