[fpc-pascal] uses myunit in '../src/myunit.pas' ?

Michael Van Canneyt michael at freepascal.org
Mon Feb 13 17:52:01 CET 2017



On Mon, 13 Feb 2017, fredvs wrote:

>> The compiler already does this.
> Yes, that I know, for one unit, but try this:

That will not work, and it should not.

unita2 can be anywhere.

The compiler should not assume that the one in the Documents directory is the one you want.

I just checked: I have about 150 copies of frmmain.pp on my harddisk.

Unless I tell the compiler exactly which one it needs to use (using frmmain in 'XYZ/frmmain.pp'), 
it should not make assumptions.

so in your case:

program p;

uses
    unita2 in 'Documents/unita2.pp',
    unita in 'Documents/unita.pp';

begin
end.

Should (and does) work.

Michael.

>
> -----------------------------------
> cadwal: >cat p.pp
> program p;
>
> uses unita in 'Documents/unita.pp';
>
> begin
> end.
>
> cadwal: >cat Documents/unita.pp
> unit unita;
>
> uses unita2;
>
> interface
>
> implementation
>
> end.
>
> cadwal: >cat Documents/unita2.pp
> unit unita2;
>
> interface
>
> implementation
>
> end.
>
> cadwal: >fpc p.pp
> cadwal: >
>
> Fre;D
>
>
>
> -----
> Many thanks ;-)
> --
> View this message in context: http://free-pascal-general.1045716.n5.nabble.com/uses-myunit-in-src-myunit-pas-tp5727626p5727650.html
> Sent from the Free Pascal - General mailing list archive at Nabble.com.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>



More information about the fpc-pascal mailing list