Skip to content

Lazarus! Get up, pick your pc up, and program!

Confused by this simplicity? It's normal, because you feel that something bigger misses: and you're right.
Remember the uses command and its meaning? It "recalls" some code previously written by other people: good-heart ones in this case, because Lazarus and FreePascal are free both in source code and in payment.

Well, what uses recalls are usually libraries: a library is a collection of code written to cover some specific programming sectors.
Forms library is required to (not only) draw windows; delete it from your code and compile again: you'll get an error, explained in the Messages frame (we strongly suggest you to do it: by errors you easily get confidence with every programming tool).

So libraries are an important measure of how reliable a tool is: you can know every technique to make bread, but without flour you must stop.

That's why we'll finish showing how to install a third-part library, specifically one of most important written forĀ  (not only) Pascal-based compilers: the Indy.
Get the last release from here (actually the 10.2.0.3) under Download voice: move the unzipped folder to a directory where you stably leave it.
Why this library? because it's so important for internet communications, and because just like Lazarus and FreePascal it's been written and maintainedĀ  for more operating systems too.

Indy folder contains a .lpk (Lazarus Package) file you can open and manage from inside Lazarus; from toolbar go to Package -> Open package file (.lpk)...; browse to indy folder, open lazarus one, and run indilaz(.lpk).

Lazarus-Compiler-Options-for-Indy
Compiler Options for Indy
Lazarus-Indy-Path-Editor
Indy Path Editor

Usually a new "Compiler Options" window will appear, where to put directly some paths relative to indy folder (to be changed with indy folder moved away).
Paths are inserted or by using Path Editor (clicking on suspension points) or by hand, if first didn't work.

Lazarus-Indy-Package-Compile-Install
Indy Package Compile & Install
Lazarus-Indy-Package-Static-Linking
Indy Package Static Linking

 

Click OK to get into window titled "Package indylaz".
Now compile (it will automatically save), waiting for a bit while; after done, click install.
Lazarus will warn you that Lazarus needs to be rebuilt e restarted, in order to get static linking (?!?!? :)).
Simply click Yes, and wait for about a minute.

Sometimes installation aborts for a very common error: compiler or IDE doesn't find a file called IdStreamVCL.pas; in this case reconfirming paths is usually enough.

Lazarus-Indy-Toolbar-Tabs
Indy Toolbar Tabs

 

Lazarus finishes to rebuild itself and restarts.

On toolbar new tabs are present; if you now want a particular indy object into your form you just have to click on that and after click on this; exactly like you did with the Button.

You know the news? you're able to compile simple but working softwares, and you know some Lazarus's internal features too, like libraries installation.
This is a big step!

If in spite of all you're still in troubles, below you find a video showing you how to do.
[Note that Lazarus version is 0.9.30 and FreePascal is 2.4.2]

Lastly i want to give you the advice to visit Lazarus forum.
But first try yourself, after search in forum, and only if you haven't solved then write into forum, specifying:

  • your problem;
  • Lazarus and Freepascal versions;
  • your operating system.

Hope this will be useful to you. Start to program, and see you on next article!