Recent

Author Topic: Incomplete "compilations ..."  (Read 5187 times)

graemejc

  • New Member
  • *
  • Posts: 33
Incomplete "compilations ..."
« on: December 13, 2021, 01:41:16 pm »
I am trying to write a program which uses other code I have written in a unit file, so I access that unit by adding the code ...

uses gjcPASCAL;

When I make changed to gjcPASCAL, I assume that "running" the program by hitting F9 would detect that changes had been made to the unit gjcPASCAL and that unit would automatically be recompiled. But it's not! "Clean up & build" seems to do it, but is there any way that I can get Lazarus to automatically detect that uses or even included files have been changed and automatically compile file that depend on the altered file.
       

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7885
  • Debugger - SynEdit - and more
    • wiki
Re: Incomplete "compilations ..."
« Reply #1 on: December 13, 2021, 01:59:06 pm »
If you share a unit between projects => put it in a package. (and remove all ppu for it, across all projects that have access).

If you add custom paths to your project settings, it gets complicated.

Bart

  • Hero Member
  • *****
  • Posts: 4689
    • Bart en Mariska's Webstek
Re: Incomplete "compilations ..."
« Reply #2 on: December 13, 2021, 02:41:12 pm »
If you share a unit between projects => put it in a package. (and remove all ppu for it, across all projects that have access).

If you add custom paths to your project settings, it gets complicated.

Huh?
I have all my own units in a folder called MijnLib and all my projects have that folerd in the -Fu parameter for their compiler settings.
If I make a change to some unit there it will get rebuild upon the nest compilation.
Why would that complicate things?

Bart

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7885
  • Debugger - SynEdit - and more
    • wiki
Re: Incomplete "compilations ..."
« Reply #3 on: December 13, 2021, 03:14:55 pm »
Well, it shouldn't. But since I read the forum, I have seen countless times when people added custom path settings and run into problems.

I don't recall each case and what exactly went wrong. Nor can I say why this does happen at all. But apparently it does.
According to my observations, a lot of people ended up seeking help after somehow managing to get into trouble with custom path settings.

Bart

  • Hero Member
  • *****
  • Posts: 4689
    • Bart en Mariska's Webstek
Re: Incomplete "compilations ..."
« Reply #4 on: December 13, 2021, 10:06:37 pm »
Well, it shouldn't. But since I read the forum, I have seen countless times when people added custom path settings and run into problems.

Most of the time this because they add path to fpc sources of lcl sources to their project.
That is a disaster waiting to happen indeed.

Bart

graemejc

  • New Member
  • *
  • Posts: 33
Re: Incomplete "compilations ..."
« Reply #5 on: December 14, 2021, 01:38:43 am »
If you share a unit between projects => put it in a package. (and remove all ppu for it, across all projects that have access).

If you add custom paths to your project settings, it gets complicated.

Packages? Fair dinkum, my computer science knowledge is desperately out of date (obviously) having last programmed regularly in the late 80s/early 90s. I'll have to research what you mean by "packages." Just bamboozled that Lazarus does not simply recognise all files and hence units that have been updated and automatically recompile them. I'm spending more time fighting with Lazarus than I am with FPC.

Nevertheless, appreciate your advice.

Thanks

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7885
  • Debugger - SynEdit - and more
    • wiki
Re: Incomplete "compilations ..."
« Reply #6 on: December 14, 2021, 01:54:22 am »
Ok, more details.
Packages. There is a menu entry and it has "create new package".  The package window, then offers "add" (or "use"?) > "to project"


As Bart indicated,  it is possible to use custom paths, and have it all working. But IMHO (and that really is just an opinion) for most people it is better to create a package.

If your use path, here are a few things.
- check, if you have a ppu for the "failing" unit, in two or more locations => if so, something went wrong.
- compile with -va  and the compiler will tell you about every file/unit. When it tries to load it, where it looks for it, if it found the ppu, pas or both....
If it only sees the ppu, then it can't recompile it. Yet, yes, if correctly set up, it should of course see the pas file too.

If you just compile, the IDE leaves it to fpc to decide what needs to be recompiled (at least I am pretty sure that is the way).
If you "build clean" the IDE removes all ppu, thus forcing fpc to compile everything.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7885
  • Debugger - SynEdit - and more
    • wiki
Re: Incomplete "compilations ..."
« Reply #7 on: December 14, 2021, 01:59:56 am »
or even included files have been changed and automatically compile file that depend on the altered file.     

I don't think the normal compile detects include files "{$I foo.inc}".

Not, tested, but if at all => make sure the inc file is listed in the Project Inspector as part of the project.
Files that are not in the project inspector, are not checked by the IDE.
And afaik (again not sure) fpc only checks the date of the pas/pp file for the unit.

graemejc

  • New Member
  • *
  • Posts: 33
Re: Incomplete "compilations ..."
« Reply #8 on: December 14, 2021, 02:33:29 am »
- check, if you have a ppu for the "failing" unit, in two or more locations => if so, something went wrong.

Duh!. Yes, I do have a ppu (or *.pas) for the "failing" unit, in two or more locations. I think that an unchanged version was being looked at by Lazarus/FPC. I'll try that.

Thanks.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7885
  • Debugger - SynEdit - and more
    • wiki
Re: Incomplete "compilations ..."
« Reply #9 on: December 14, 2021, 04:57:45 pm »
Just to clarify, I meant:
More that one ppu for the pas, within the folders seen by fpc when compiling the project.

Otherwise, you would obviously have one ppu, within the each of the projects lib folders. But since project A does not see the lib folder of project B => that is no issue.

 

TinyPortal © 2005-2018