Recent

Author Topic: Compiler can't find a unit.  (Read 8944 times)

Prime

  • Jr. Member
  • **
  • Posts: 62
Compiler can't find a unit.
« on: July 21, 2009, 05:50:34 pm »
Hi,

I'm trying to port a simple ldap query app I wrote from Delphi 7 to Lazarus, the app uses the synapse libraries, so I have downloaded them and unpacked them in my Lazarus libraries directory :-

E:\LazLibs\Synapse

Searching the forums here indicated that I could include them in all projects where needed by adding the source directory to the Additional source search path in Environment -> options -> codetools I have added this :-

E:\LazLibs\Synapse\source\lib\

However when I atempt to compile my app the compiler complains that it cannot find ldapsend :-

Code: [Select]
..\SharedUnits\RamothLdap.pas(1,1) Fatal: Can't find unit ldapsend used by RamothLdap

Which is in the directory indicated above :-

Code: [Select]
D:\>dir E:\LazLibs\Synapse\source\lib\ldapsend*.*
 Volume in drive E is Stuff
 Volume Serial Number is 58E0-F397

 Directory of E:\LazLibs\Synapse\source\lib

10/12/2005  22:05            35,893 ldapsend.pas
               1 File(s)         35,893 bytes
               0 Dir(s)  33,433,157,632 bytes free

What am I doing wrong, and how can I fix this, I'd rather not go down the 'just compile the required units intou your projects directory' as this makes keeping all the verstions in sync between multiple projects much more difficult.

Cheers.

Phill.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9874
  • Debugger - SynEdit - and more
    • wiki
Re: Compiler can't find a unit.
« Reply #1 on: July 22, 2009, 05:44:47 pm »
> "he Additional source search path in Environment -> options -> codetools I have added this :"

Codetools path is used only for editing in the IDE. eg it is used, when you want to jump to the declaration of something.

The IDE then needs to find the source file.  This info is not shared with the compiler.

You can add additional unit paths -FU, under "projcet => compiler options". This should do the trick. (if it has include files you also need -Fi)

This will however mean those units get recompiled each time. The ppu files will be stored with each project.

The normal way would be to add this as a package (I do not know it this comes with a package file?).
If possible, then you compile it once (or once each time you make changes), and then you add the package to your project, and need not worry about any path



theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Compiler can't find a unit.
« Reply #2 on: July 22, 2009, 05:51:09 pm »
Codetools path is used only for editing in the IDE. eg it is used, when you want to jump to the declaration of something.

Are you sure? Reading this http://wiki.lazarus.freepascal.org/IDE_Window:_Codetools_Options#Additional_Source_search_path_for_all_projects.2Fpackages
one could believe it is a "general" setting.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9874
  • Debugger - SynEdit - and more
    • wiki
Re: Compiler can't find a unit.
« Reply #3 on: July 23, 2009, 12:24:42 am »
Quite sure: yes.

but check it yourself, if you run lazarus with logfile, (or have it compiled with windows console) then you should be able to see all the calls made to the compiler. You will find, the path is not handed over.


The help is indeed a bit misleading: "global" for "codetools" (as it is a codetool help page)

Codetools is everything where the IDE helps you editing your text, such as jumping to declaration, or completion of code.
For this the IDE needs to know where all you .pas files are, so the IDE can build knowledge about them.

As it says, you don't need to worry, if you do packages.

If Synapse has an ".lpk" (lazarus package file) then just install it as package. And use the package in your project

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Compiler can't find a unit.
« Reply #4 on: July 23, 2009, 12:51:12 am »
If Synapse has an ".lpk" (lazarus package file) then just install it as package. And use the package in your project

Afaik it doesn't. But it shouldn't be rocket science to create a package.
I've hacked one in 3 minutes. Don't know if 100% correct but it compiles.
See attachment.

 

TinyPortal © 2005-2018