[Lazarus] Problem Finding Units

Martin lazarus at mfriebe.de
Sat Jul 9 16:03:21 CEST 2011


On 09/07/2011 14:27, David Riley wrote:
>
> Yes, the highlighter is currently in code, I'm not quite ready to mess
> with registering it yet as it is still under heavy development and I'm
> more comfortable just having it as a separate unit in my project.
>
> I've done some experimenting with just the highlighter unit and an empty
> project, and when I removed the {$I synedit.inc} line from the
> highlighter (I'm currently using none of the defines in the file anyway)
> everything compiled fine.  So looking through the verbose output as you
> told me to, I found that the synedit.inc file is in the source directory
> or the synedit folder which is not in the search path.  I also found
> that in that project that the compiler searched for synedit.pp instead
> of the compiled .ppu files in the units directory.  So now at least I
> have a good workaround so I can continue development and testing on the
> highlighter.

Hm, interesting. Not sure why/how removing the SynEdit.inc does match up 
with your original description (but there are many possibilities

For the inc file you could use -Fi, but I would advice taking a copy of 
the file (if at all ever needed, which I doubt)


> Excuse my lack of knowledge on the way units work in Pascal, I'm still
> learning "The Pascal Way" which is very nice, but a bit different that
> what I'm used to.  I'd imagine in this case it's probably best to create
> a separate project for the highlighter itself and compile it in to it's
> own unit and learn the process of registering a component in the ide?
> That way once I start finishing up the highlighter and add in the
> conditionals in the proper spots (for Delphi compatibility and such,
> like is featured in the other highlighters) I won't have to worry about
> the synedit.inc file messing up the search paths for the larger
> project.
>
First of all: The $IFDEF SYN_LAZARUS are a relict from old days. They 
are in the (very slow) process of being removed). SynEdit only compiles 
with them enabled. IT does not compile without them anyway.
The SynEdit in Lazarus does not currently compile in Delphi at all.

You can make your Highlighter compilable in Delphi of course. That would 
make sense if you want to use it with the original SynEdit (sourceforge, 
non Lazarus version). However the Lazarus SynEdit has a modified 
interface for it's highlighters. So there would be a bit of extra work, 
to maintain the differences.

-------------
About you original problem:

SynEdit is a package, The Lazarus IDE has at sometime compiled this 
package. In the synedit folder (like in any package, like in the RTl, or 
even your project) you find a folder (usually named "units" or "lib") 
containing ppu files.
The ppu files are only usable for the EXACT version of FPC that created 
them.
If your project uses SynEdit, the in Lazarus, it must depend on the 
package synedit. This will add the path to the ppu files. And only to 
the ppu files. FPC does not (and should no need to ) know about the pas 
files

However if you do something in your project, that makes fpc believe that 
the SynEdit.ppu is outdated, then FPC wants to recompile it. But as 
Lazarus has fully intentional not told FPC were the source is, fpc can't 
recompile it => unit Synedit not found (lazarus of course knows were it is)

One reason why fpc may believe it want to recompile it, is if fpc sees a 
unit that is used by synedit and is newer than synedit. (This does not 
apply to the inc file )

e.g ig you COPIED SynEditHighlighter.pas (the base class of the 
highlighters) to your project.
Then FPC sees the new SynEditHighlighter.ppu, and it says Synedit.ppu 
depends on this, and since the SynEditHighlighter.ppu is newer 
(changed), then Synedit must be recompiled.

The include file does not produce a ppu file (it's embedded into each 
file that uses it).
It also is NOT your own highlighter. Since in Synedit.pas, there is no 
"uses yourhighlighter". SynEdit does not depend on your highlighter.

So your initial error sounded like you copied a file (other than the 
inc)  from the synedit directory to your project.

Of course, instead of having copied a file, you may also have added an 
include path to your project, that added the synedit directory as search 
path for pascal files to your project. Anopther thing that should bnever 
ever be done.
With such an include path, if compiling your highlighter, files used by 
your highlighter (like the base class SynEditHighlighter.pas) will be 
recompiled, and create a ppu file in your project (same as with the 
copied pas file)...

So in case like this. look at your projects "lib" folder and find any 
ppu that should not be there. Then find out why it is there....








More information about the Lazarus mailing list