[fpc-pascal] Syntax problem with first unit

Mehmet Erol Sanliturk sanliturk at ttnet.net.tr
Sun Apr 5 06:33:17 CEST 2009



Francisco Reyes wrote:
> Trying my first unit and getting an error I can't figure out.
>
> --- unit
> unit debugprint;
> Interface
> function DebugPrint(ProgLevel, CallLevel:integer; MessageIn: 
> string):string;
>
> Implementation
>
> function DebugPrint(ProgLevel, CallLevel:integer; MessageIn: 
> string):string;
> begin
>     if ProgLevel>= CallLevel  then
>         DebugPrint := MessageIn ;
> end;
>
> end.
>
> --- Program to test unit
> program tdp;
> uses debugprint;
>
> var
> Msg: string;
>
> begin
> writeln ('hello world');
> Msg := DebugPrint(0,1,'Debug message');
> writeln(Msg);
> end.
>
> ------
>
> Getting an error
> tdp.pas(9,18) Fatal: Syntax error, "." expected but "(" found
> Line 9 is the call to the function in the unit.
>
> If I take the function and move it from the unit to the main program 
> it works fine.
>
> Any pointers greatly appreciated.
Unit and function names DebugPrint are the same .
Pascal is case insensitive . Making their cases different does NOT
make them different .


Please make them different and retry .

Thank you very much .

Mehmet Erol Sanliturk









More information about the fpc-pascal mailing list