Sign in Join
Wiki copytemporary

FPC message: Can not find unit

Deutsch · English · Français · Magyar

General hints

Example:

 unit1.pas(40,42) Fatal: Can't find unit forms

The compiler didn't find a compatible forms.ppu file nor a source file (forms.pp or forms.pas or forms.p).

The compiler searches in the unit path. The unit path is the sum of:

Note: Even if there is a forms.ppu file in the unit path, the above message can appear, because FPC checks if the ppu file is valid (up to date). The .ppu file is valid, if all files it depends on are valid. If you install another FPC all .ppu files on your system become invalid and must be recompiled. It may be useful to run Lazarus in a terminal (cmd window) to see the actual error FPC shows.

If using FPC, you can show where it searches for units by adding the -vut options, e.g.

bash
fpc -vut myprogram.pas

Can't find unit interfaces

The 'interfaces' unit is the part of the LCL. You must use it at least once in your program to link in the LCL interface (the platform dependent part of the LCL. For instance gtk or win32). If you see this error:

Can't find unit LResources

Can be solved by doing "Tools/Build Lazarus"

Can't find unit System

This often happens with console IDE on Ubuntu systems. To fix it, follow this solution.

Also maybe you're trying compile your project to other "Target OS". See "Project -> Project Options -> Compiler Options -> Code generation -> Target OS (-T)" and change them to (Default) (or in blank).

Detailed description about this topic

There is a detailed page about searching units here: Unit not found - How to find units

See also


From the Free Pascal wiki, page "FPC message: Can not find unit", as it stood on 2022-07-25 after a change by Mbr, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.