Installing and using Lazarus

The following steps describe how to download Lazarus and start using it.

  1. At the command prompt, type sudo apt-get install lazarus.
    You will see the amount of space required.
  2. Accept the invitation to continue.
    It should take about ten minutes for the download and installation of Lazarus.
  3. 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.
  4. Select menu option Run > Run Parameters and click in the checkbox entitled "Use launching application".
  5. Paste or type into the edit box (just below the checkbox) the line: /usr/bin/x-terminal-emulator -T 'Hello World' -e $(LazarusDir)/tools/ $(TargetCmdLine)
    (There is a drop-down list of previous values for this entry that may be useful for later programs).
  6. Execute your program by clicking on the green triangle icon.
  7. 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.
  8. 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.

Programming - a skill for life!

Setting up the Raspberry Pi, installing Lazarus, use of the GPIO port (with and without PiFace), web servers and remote control