[comp.lang.pascal] Having problem with Make

F0O@psuvm.psu.edu (01/10/91)

     I'm having a problem using the make facility in the IDE with TP 5.5.
In my main program I have a line like:
     USES Crt, Dos, GVars, GPrim, GKernel;  { last three are mine }

     In the GPrim unit I have a line:
     USES GVars;

     In the GKernel unit I have a line:
     USES GVars, GPrim;


     The problem is, if I modify GPrim or GVars, compile the unit to disk,
load my main program and make it, I get the message:
     Unit version mismatch

     I have tried just modifying the unit without compiling it to disk, and
then loading and making my main program.  This doesn't work either.
     Can someone please tell me what I'm doing wrong(if anything)?
     BTW, I've also tried using build.

                                                        Thanks muchly,
                                                              [Tim]

zhou@brazil.psych.purdue.edu (Albert Zhou) (01/12/91)

If you have modify a unit (say A) which was used by another unit (say B),
you'll have to recompile unit B when your main program use both A and B.
The compiler will not automatically recompile it for you, but it will give
you that error message you mentioned. That's because the compiled program
must only contain one copy of each subroutine in A, which will cause con-
tradition if unit A is different from the one that unit B used.

Example:

Suppose procedure anything(x: real) was in unit A which unit B used. Now
you modify it to procedure anything(x: integer). And in main program
you use this procedure in unit A. If only one copy of this procedure is
included in the compiled .EXE program, should x be integer or real?  It
can be solved only by recompile (or even modify the source code of ) unit
B.