Recent

Author Topic: (Win32) "Fatal: Can't find unit XXXX" when compiling control package  (Read 5138 times)

eye776

  • Newbie
  • Posts: 6
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

  • Newbie
  • Posts: 6
Re: (Win32) "Fatal: Can't find unit XXXX" when compiling control package
« Reply #1 on: March 30, 2011, 11:54:42 am »
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...
« Last Edit: March 30, 2011, 12:10:19 pm by eye776 »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11458
  • FPC developer.
Re: (Win32) "Fatal: Can't find unit XXXX" when compiling control package
« Reply #2 on: March 30, 2011, 04:52:29 pm »
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.

 

TinyPortal © 2005-2018