Page 1 of 1

Pascal language - Free Pascal Compiler Error!

Posted: Sun Jul 20, 2008 8:25 am
by matt140
Hi All!

Ive been searching for ages for a tutorial for using Pascal as a language for
OS development. When I try to compile kernel.pas (from http://wiki.osdev.org/Pascal)
it generates the error: Can't find unit system used by kernel. However, the System unit isn't
in the uses list!

Any ideas, hope you can help!
Thanks, Matt.

Re: Pascal language - Free Pascal Compiler Error!

Posted: Sun Jul 20, 2008 9:04 am
by thepowersgang
What command are you using to compile the kernel?
There should be an option to disable automatic includes in the command line.

Re: Pascal language - Free Pascal Compiler Error!

Posted: Sun Jul 20, 2008 9:06 am
by matt140
Heres the command i'm using:
fpc -Aelf -n -O3 -Op3 -Si -Sc -Sg -Xd -Rintel -Tlinux kernel.pas

Any Ideas?
Thanks, Matt.

Re: Pascal language - Free Pascal Compiler Error!

Posted: Sun Jul 20, 2008 12:22 pm
by Laksen
The system unit is automatically included whether you want it or not. This is theoretically where all the types and runtime routines are defined. Ofcourse some are defined by the compiler internally. But you'll have to supply a few. HResult must be defined for example

just make a system.pas like this:

unit system

interface

type
Cardinal = 0..$FFFFFFFF;
HResult = Cardinal;

implementation

end.

Re: Pascal language - Free Pascal Compiler Error!

Posted: Tue Jul 22, 2008 12:53 am
by leledumbo
Don't forget to add {$FPC_IS_SYSTEM} directive or it will still try to add implicit uses System; statement.