(Win32) "Fatal: Can't find unit XXXX" when compiling control package lazarus / 31-LCL ---------------------------------------------------------------------- eye776 · 2011-03-30 09:10 I have a (very simple) Delphi 6 application that is simply a front for the functions in a C++ DLL. Since the latest Delphi is no longer free (even for personal use) and Delphi 6 and 7 are kind of old, I wanted to port my front application to Lazarus. After a clean install of the latest win32 package "lazarus-0.9.30-fpc-2.4.2-win32.exe", using the tutorial for adding a control I created a package and added the only custom control I use. When compiling the custom control package I get "Fatal: Can't find unit XXXX" errors (units are really basic ones like Graphics, Controls, Forms, etc.). Rebuilding Lazarus and making projects inside it works fine however. Any ideas as to what might be wrong? ---------------------------------------------------------------------- eye776 · 2011-03-30 09:54 Yeah, so in the end I figured I might as well try a hunch: Recreate the control instead of adding the .pas file to the package. As per tutorial: Step 1: Create The Package On the Lazarus IDE menu, click Package > New Package Step 2: Create The Unit Use the Add button -> New component I chose TPanel, and used the custom control's name. --- Tutorial stops here --- Step 3: Copy-pasta Proceeded to open the .pas file in notepad -> copy paste -> lazarus. Step 4: Click compile. Step 5: MAGIC. IT WORKS. WTF O_o !? So why can't I simply add a .pas (containing a control) file to the package? Will this change in the future (worried about backwards compatibility). Can I rely on Lazarus or can it be prone to breaking my project every now and then ? EDIT: Apparently it works (and it's quite fast at that). Onward to porting... I guess... ---------------------------------------------------------------------- marcov · 2011-03-30 14:52 Lazarus has a system to manage include and unit dirs more efficiently. For this it has a dependancy system of packages, that decouples projects from components paths. So if you have a project that uses Zeos, and two machines that have Zeos installed in separate dirs, the project will keep working without differences. (since the project only has a dependancy on Zeos, which has different include paths on separate systems) Anyway, just add the LCL as dependancy of your package.