[fpc-pascal] Unit path search order

Martin Schreiber mse00000 at gmail.com
Sat Apr 23 11:18:48 CEST 2016


On Saturday 23 April 2016 10:40:58 Jonas Maebe wrote:
> Martin Schreiber wrote:
> > http://www.freepascal.org/docs-html/current/user/usersu7.html#x21-280003.
> >1.2 states:
> > "
> > You can add a directory to the unit search path with the (-Fu (see page
> > 100)) option. Every occurrence of one of these options will insert a
> > directory to the unit search path. i.e. the last path on the command line
> > will be searched first.
> > "
> > Does this still apply?
>
>  From looking at the compiler code: yes.
>
I made a test.

in ./:
"
program conssoletest;
uses
 testunit;
begin
 testunit0();
end.
"

in ./test:
"
unit testunit;
interface
procedure testunit0();
implementation
procedure testunit0();
begin
end;
end.
"

in ./test1:
"
unit testunit;
interface
procedure testunit1();
implementation
procedure testunit1();
begin
end;
end.
"

"
mse at linuxmse:~/proj/consoletest> fpc -oconssoletest -Fu./test -Fu./test1 
conssoletest.pas
Free Pascal Compiler version 3.0.0rc2 [2015/10/14] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling conssoletest.pas
Compiling ./test/testunit.pas
Linking conssoletest
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
14 lines compiled, 0.2 sec
"

"
mse at linuxmse:~/proj/consoletest> fpc -oconssoletest -Fu./test1 -Fu./test 
conssoletest.pas
Free Pascal Compiler version 3.0.0rc2 [2015/10/14] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling conssoletest.pas
Compiling ./test1/testunit.pas
conssoletest.pas(5,2) Error: Identifier not found "testunit0"
conssoletest.pas(7) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode
"

Martin



More information about the fpc-pascal mailing list