Computing: Free Pascal Programming

Installing Lazarus/Free Pascal on MS Windows.


The Lazarus IDE (including Free Pascal, LCL and other libraries, build tools and debugger) may be freely downloaded from the Lazarus Project website. You'll find there a Windows 32bit as well as a 64bit installer. The following document describes how to install both the 32bit and 64bit versions on the same machine (my Windows 10, 64bit), what needs some special attention, but finally may be easily done thanks to the secondary installation option, provided by the Lazarus setup program. The Lazarus version, I actually use, is version 1.8.4 (with FPC 3.0.4).
Installing Lazarus 32bit.
As I preview to normally use the 64bit version (as is my system), I decided to install the 32bit version first; thus, if some settings should be overwritten, those that actually apply, will be the 64bit ones.
Starting the installation by double-clicking the installer. 3 settings to consider:
  • Choosing an install folder specific for the 32bit version (in my case: C:\Programs\lazarus\win32).
  • Choosing a Start menu folder specific for the 32bit version (in my case: Lazarus 32bit).
  • Do NOT set any file associations (as previewed to use the 64bit version as default).
Installing the Lazarus IDE
When I started Lazarus, it displayed a message, saying that the configuration at C:\Users\[user name]\appdata\local\lazarus belongs to a Lazarus installation started from C:\Programs\lazarus. This is due to the fact that I had installed Lazarus before (at the mentioned location); if you make the installation for the first time, this message will not appear and after having installed the 32bit version, you can immediately continue with the installation of the 64bit version. In the case, where there has been an installation before, in the dialog displayed, choose "Update info": This will grant the updated configuration (at C:\Users\[user name]\appdata\local\lazarus) exclusively to the actual Lazarus installation.
Previous Lazarus installation warning
Upgrade is done and the Lazarus IDE configuration window is displayed. Check if all components (Lazarus, compiler, fpc sources, make and debugger) have been found. This should normally be the case.
Lazarus IDE configuration
With Lazarus already being installed before and the configuration file of that installation used as base to create the actual one, the IDE opens with the Free Pascal project you last worked on with your old installation.
Free Pascal project within the Lazarus IDE
Installing Lazarus 64bit as secondary installation.
Double-click the 64bit setup program to launch the installation. When asked for the installation folder:
  • Choose a folder specific for the 64bit version (in my case: C:\Programs\lazarus\win64).
  • Check the checkbox "Create a secondary installation". This tells the setup program that there is already a Lazarus installation on the computer and that both installations (if you'd liked, these could of course also be two different versions of the 64bit application) are intended to be used in parallel.
In order to avoid conflicts between the 2 Lazarus installations, each of them needs its own configuration file. Thus, the setup program asks you to specify the folder, where the configuration of the actual Lazarus should be stored. I choose to simply put it with my 64bit Lazarus files (C:\Programs\lazarus\win64\config); a wiser choice, in particular on a multi-user machine, would have been to save it into some application data folder, e.g. C:\Users\[user name]\appdata\local\lazarus64.
Lazarus secondary installation selection
Lazarus secondary installation configuration folder
Continue installation with
  • Choosing a Start menu folder specific for the 64bit version (in my case: Lazarus 64bit).
  • Choosing to install the help files, by checking the corresponding checkbox; this gives access to fpc help from within the IDE.
  • Associating the concerned files with Lazarus (64bit). This is not really necessary, but lots convenient. First, it allows you to open files by simply double-clicking them (in particular, double-clicking a .lpi or .lpr file will open the corresponding Lazarus project with, i.e. inside, the IDE). Second, files will be clearly identified in File Manager (Windows Explorer): Instead of "LPR file" and "PAS file", display will be "Lazarus Project main source" and "Pascal source code". You may want not to check all files here; for example .inc and .res files are more general file extensions, that are also used with other programming languages. The most important is the .lpr file extension, as double-clicking it, opens the project with all associated forms and sources.
Lazarus file associations
In the "Additional Tasks" window, be sure that the "Delete all user configuration files from previous installs" is UNchecked. This avoids always possible bad surprises and there actually aren't any files we don't want (my old installation having been upgraded to the new 32bit version, the old files are now part of that install and so files we want to keep).
Keeping the configuration from previous installs
When launching Lazarus for the first time, the IDE configuration window is displayed (cf. 32bit install). Check if all components (Lazarus, compiler, fpc sources, make and debugger) have been found and are well those of the install done to the C:\Programs\lazarus\win64 folder.
The 64bit Lazarus having been setup with a new configuration file, the IDE opens with an empty new project. Arrange the different windows as you like. Be sure the main window, the Object Inspector, the Source Editor and the message windows are positioned in a way, you can easily view and access their content. To display a form, being part of your application, choose it in the "Window" menu. Sometimes this does not work; in this case, click the "Forms" icon (2nd from the left in the second menu icons row), here all forms are listed and you can select the one, you want to bring to the front.
New Free Pascal project within the Lazarus IDE
Notes:
  1. When building an application for the first time, some versions of Lazarus 2.2 pop up a dialog box asking to select the Dwarf format for debugging. I always chose to push the Enable Dwarf 3 (-gw3) button, that always worked fine for me.
  2. When double-clicking a .lpi file with the new Lazarus 3.0, a dialog box pops up, asking the user what they actually want to open (as all previous versions of Lazarus did on Linux). Obvious that normally, you'll have to push the Open project button.


If you find this text helpful, please, support me and this website by signing my guestbook.