A N N O U N C E M E N T S |
This FAQ concerns Lazarus 0.9.24. |
---|
Lazarus 0.9.24 for Windows together with FreePascal 2.2.0 is pre-installed (via full install on the disk image) on laptops of first-year 2008-2009 students in the Department of Mathematics and Computer Science at TU/e.
You can check this in het Windows START menu under All Programs: Lazarus should be available in a submenu.
You can install Lazarus yourself:
N.B. You are strongly advised to completely remove old Lazarus and FreePascal installations first.
Note that certain personal Lazarus settings are
stored outside the installation folder,
e.g. in your AppData\lazarus\
(Windows) or
~/.lazarus/
(Linux) folder.
You may wish to keep these settings.
However,
if you are installing a new Lazarus version
because of troubles with the older installation,
then it may be advisable to remove those personal settings first.
Remove the entire folder; Lazarus will create a fresh set of initial settings.
Also see: I upgraded Lazarus and it no longer works. What now?
See Getting Started with Lazarus at TU/e.
This concerns a fresh Lazarus installation as it appears on the disk image for first-year Computer Science students at TU/e. If you did the installation of Lazarus yourself, or if you changed your Lazarus installation, or used it already for some time, then you should also look at some of the other questions: |
Unfortunately, we have had instances where even the simplest program fails to run properly from within Lazarus. This is probably related to the debugger. The FreePascal compiler works fine.
To use the Lazarus debugger under Windows Vista,
it is useful (necessary?) to set a property of Lazarus.exe
(typically found in C:\lazarus\
)
to `Windows XP Compatibility'.
It is also possible to disable the debugger in Lazarus through the menu
Environment > Debugger Options ... > Generaland at "Debugger type and path" select "(None)". It is not necessary to use the debugger to complete the course 2IP05.
Some troubles can be solved by removing personal settings,
that may have become corrupted.
Certain personal Lazarus settings are
stored in your AppData\lazarus\
(Windows) or
~/.lazarus/
(Linux) folder.
Remove the entire folder; Lazarus will create a fresh set of initial settings.
Alternatives are:
*.exe
) in a separate
command window (type `cmd
' at the START menu).
This way, it is not possible to step through the program's execution. But one could add writeln(...) ; readln statements at appropriate places to accomplish a similar effect.
In the course 2IP05, the use of the debugger is not required. Only in the first week, there is one exercise that explicitly refers to facilities provided by the debugger.
.lpr
or .pas
file.
Compile the program in a command window using
fpc
file.
You need to ensure that the compiler can be found,
by including its path in the environment variable %PATH%
.
It is advisable to compile with the following options:
fpc -CirotR -vewnh -Mdelphi -gl -Sah
file
The options can be put in a configuration file (fpc.cfg
).
Execute your program from the command window (see previous bullit point).
*.dpr
.
The projects that we make available are Lazarus projects.
For Blocks A and B, you can simply rename the *.lpr
file
into *.dpr
and create a Delphi project from that.
Consult Getting Started with Lazarus
to find out about recommended project options
(in particular those for the compiler).
When you upgrade Lazarus, it is best to remove the old installation first.
Do this with the uninstaller, or by removing the Lazurus folder
(on Windows typically in C:\lazarus
).
Furthermore, it may be possible that some older settings survive the upgrade, in particular, to the FPC compiler and its source files. These settings can be upgraded manually:
Also see: How do I install/upgrade Lazarus?
See Running the program in a project.
I consider this a bug.
Workaround. Environment Options ... > Windows: uncheck `Hide IDE windows on run'.
When the program is not yet running and you click Run (or menu Run>Run, or function key F9) to start it, the command window may appear but the program's output does not appear, and the program seems to be stuck.
Workaround. Stop program execution via Run>Stop (Ctrl+F2). Reset the debugger by Run>Reset debugger.
After each run, the debugger should be reset to avoid this problem from reoccuring.
When the program is not yet running and you click Step Over
(or menu item Run>Step Over, or function key F8)
to start it,
a dialog window may appear,
asking you to locate system.inc
. (Bug?)
Dismiss this dialog window by clicking `No'.
Workaround. Set a Breakpoint on the first line after the program's first begin (by clicking next to it in the left margin; this should highlight the line in red and mark it with a red bullet). Then Run > Run (F9) the program. After that, you can use Step Over (F8).
This sometimes does not work for some variables. (Bug?)
N.B.
The program must be active
(the Lazarus Toolbar should have (debugging ...)
in its title)
in order to inspect variables.
Workaround. Put the variable in the Watch List: View > Debug windows > Watches, double click on the topmost empty line, and enter the variable's name next to Expression, click OK.
Usually, the explanation is that peach³ compiles programs with Range Checking enabled and with Use Ansi Strings enabled (also see here), and your laptop does not.
When indexing strings the index must be inside the current
range of the string, i.e., for s: String
evaluation of s[i]
requires
1 <= i <= Length(s)
.
See here for recommended settings and how set them.
It is always recommended to save work often when using a computer. With the default settings, Lazarus automatically maintains a backup of various files in a project. You can inspect and adjust the backup setting through
Environment > Environment Options ... > BackupTypically, Lazarus keeps backups in a separate folder named
backup
inside the project folder, but this can be changed.
One should be careful about renaming files that belong to a Lazarus project.
N.B.
File names appear in several places,
such as in the *.lpi
Lazarus Project Information file,
and (explicitly or implicitly) in uses
clauses
to indicate dependence on units in other files.
When changing a file name,
this should usually be done in a consistent manner.
Workaround. Open the file to be renamed in the Source Editor. Use File > Save As ... to save a copy under the changed name. Find (e.g. through the Search menu) other files in the project that somehow reference the old name. Change relevant occurrences to the new name. Remove the old file from the project, and add the new file to the project. Delete the old file or move it outside the project folder, to avoid confusion.
N.B. Opening a file belonging to a project, and removing from/adding to the project can all be done through Project > Project Inspector.
*.lpr
, content starting with program
).
Choose for "Create Custom Program".
In that case, you get a default project, whose option settings do not correspond to the preferred TU/e options in the project TUeConsoleApp. More information on setting project options.
You still need to save it in an appropriate place.
Additionally given units
(typically *.pas
, content starting with unit
)
can be added to the project by putting them in the same directory,
opening them with the editor, and doing
Project > "Add editor file to project".
A procedure that needs to read from or write to a (text) file should have this file as a var parameter.
The reason is that both reading and writing may change the state of the communication port associated with the file. The parameter passes this communication port (and not the actual file contents), which keeps track of where the next read/write operation will take place (i.e. the location of the read/write head). Both for reading and writing, the read/write head is at a certain location when the procedure is invoked: the parameter appears in the precondition, stating that it is open for reading/writing. Afterwards the location of the read/write head in the file has changed. Hence, the file parameter (the communication port) must be passed as a var parameter.
It is the case that by reading the contents of the file do not change.