[Lazarus] Feature request: Single-file mode

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Sep 14 16:08:19 CEST 2012

Alexander Klenin <klenin at gmail.com> hat am 14. September 2012 um 15:35
> See this forum discussion for context:
> http://forum.lazarus.freepascal.org/index.php/topic,17932.msg102309.html#msg102309
> Below is the relevant portion of my post:
> Finally, I have closely related, but more complex, request --
> introduce "Single-file mode" into Lazarus,
> where Lazarus does not create .lpi and .lps files, stores executable
> and object file

No lpi, so no compiler options and no packages.

> in the same directory as source, and does not save desktop settings.
> This mode can be triggered by either command line switch:
> "lazarus.exe --single homework.lpr",
> special directive in source:
> {%singlefileproject},
> or a heuristic:
> enter single-file mode when passed a project name from command line,
> and corresponding .lpi and .lps files do not exist.
> "Project" menu item should be disabled/hidden in this mode.
> The main use case, besides obvious beginner education, is competitive
> programming,
> where in a typical contest participant may need to create 5-12
> single-file projects in a time period of 3 to 5 hours.

There is already a single file feature under Run / Configure Build+Run file. At
the moment Run simply executes it. It does not use the debugger.
The compiler options and run parameters are saved as IDE directives in the
You can have an arbirary number of such single file programs and they are
compiled and run with the shortcuts.
Of course there is room for improvements. For example the project has higher
precedence. For students a special project might be needed that favors single
file programs.


More information about the Lazarus mailing list