Installing and using Lazarus
The following steps describe how to download Lazarus and start using it. (There are up-to-date installation instructions on the Free Pascal wiki. In January 2020, we were able to install Lazarus on a newish Debian Buster operating system on our Raspberry Pi by issuing the commands sudo apt-get update, sudo apt-get upgrade and sudo apt-get install fpc before sudo apt-get install lazarus.)
At the command prompt, type sudo apt-get install lazarus.
You will see the amount of space required.
Accept the invitation to continue.
It should take about ten minutes for the download and installation of Lazarus.
Write a "Hello World" console program as shown in Steps 1 to 11 of Writing your First Pascal Program using Lazarus.
The program should compile, giving an executable, but the console may not appear.
- Select menu option and click in the checkbox entitled "Use launching application".
Paste or type into the edit box (just below the checkbox) the line: /usr/bin/x-terminal-emulator -T 'Hello World' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)
(There is a drop-down list of previous values for this entry that may be useful for later programs).
- Execute your program by clicking on the green triangle icon.
Start a new simple forms-based application and confirm that this works "out of the box".
Be prepared to meet problems if you try to compile projects that have been developed in more recent versions of Lazarus than the one that is readily available to the Pi by the apt-get install lazarus command. You might be able to (1) simplify the text view of the form by removing new features or (2) start from scratch and just use the information in the text view of the form to and manually add components to a new form.
You can now work through our tutorials and try some of the student programs on this site.
Avoid programs using the Windows, WinGraph, WinMouse and WinCrt units unless you are good at finding Unix alternatives.
We have tested (in the order given in the table) ChristmasProg, RockPaperScissors, BigFibonacci, CombinationPermutation, Betting, Battleships, DelphiManager, Arithmetic, Calculator, Trains, MatrixInverter, Physics, ascii3D, Risk and SnakeWithoutATail (version 3).
The next topic describes how to install SDL libraries for advanced graphics.