Difference between revisions of "FPC message: Can not find unit"

From Lazarus wiki
Jump to navigationJump to search
Line 30: Line 30:
  
 
Can be solved by doing "Tools/Build Lazarus"
 
Can be solved by doing "Tools/Build Lazarus"
 +
 +
== Can't find unit System ==
 +
 +
Maybe you're trying compile your project to other "Target OS". See "Project -> Compiler Options -> Code -> Target OS (-T)" and change them to (Default) (or in blank).
  
 
== Detailed description about this topic ==
 
== Detailed description about this topic ==

Revision as of 16:20, 21 March 2008

Deutsch (de) English (en) français (fr) magyar (hu)

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:

  • the fpc.cfg file (linux, macosx, bsd: /etc/fpc.cfg)
  • the Lazarus compiler options. See Project -> Compiler Options
    • -> Paths -> Other unit files
    • -> Inherited -> All inherited options -> unit path (if available)

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.

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). You see this error, if

  • Make sure the project uses the LCL package. See Project -> Project Inspector -> Required Packages. If there is no LCL click on the 'Add' button and then 'New Requirement', select the LCL and press Ok;
  • Make sure the unit is part of the project. Use Project -> Add editor file to project;
  • Make sure the 'interfaces.ppu' is in the unit path, and the 'interfaces.pp' is not in the unit path. And that you only have one 'interfaces.ppu' in the unit path. You can see the unit path in Source Editor -> Right mouse click -> Popup Menu -> Unit Info -> Unit Paths;
  • Make sure your compiled LCL fits to the installed compiler. For example if you installed a new compiler, then the LCL must be rebuilt (for example the interfaces.ppu must be rebuilt);
  • Make sure the project compiles the correct (current) widgetset. See Project -> Compiler Options -> LCL Widget Type (various). Change it to "default (*****)" to use default widgetset. If you don't want compiles with default widgetset, then change this value to any value, and recompile LCL to respective widgetset (win32/win64, gtk, gtk2, etc).

Can't find unit LResources

Can be solved by doing "Tools/Build Lazarus"

Can't find unit System

Maybe you're trying compile your project to other "Target OS". See "Project -> Compiler Options -> Code -> 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