Jonas Maebe wrote:

On 19 Apr 2010, at 16:15, Tobias Giesen wrote:

This usually means that they were compiled by a previous compiler, or
that they use units which have been changed and recompiled since the
previous compilation. In that case, the compiler will ignore the
precompiled unit and try to recompile it. If it then doesn't find the
sources, you'll get an error about the unit not being found.

Yes but the sources were there. They were in the search path, but the
compiler didn't search properly. I will look into it again and if there
are bugs, I will fix them in the FPC sources and submit the fixes.

If you have such problems in the future, compile with -vut and the compiler will show where and what it searches, andwhy it refuses certain units or recompiles them.

(Recompiling XYZ.pas because the checksum changed although it didn't).

I deleted all .o and .ppu files and still this happened. I'm not mixing
anything. The problem is that FPC sometimes doesn't like its own units -
maybe because of different compiler switches?

In some cases, the compiler will want to immediately recompile previously compiled units: a) if you use a unit that has in its interface section a procedure that is declared normally, but which is declared as "external". Solution: declare it immediately as "external" in the interface and remove the version in the implementation b) if you have inline procedures in the interface of unit1 and a unit that uses unit1 is (indirectly) used in the implementation of unit1. Solution: compile everything with -Ur (= "create release units"; the compiler will never try to recompile such units afterwards, except if the interface section of a unit that it uses has been changed and this other unit has been recompiled).

Another, more seldom reason for recompilation problems is that you happen to name one of your own units the same as a rtl/fcl/lcl library unit. In that case the compiler thinks that your file is the new source and it wants to recompile the library units
Like Jonas said, you will find this when compiling with -vut
Solution, rename your unit.

(happend once to me with some obscure unit, and took some time to figure out)

Marc


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to