Pascal language - Free Pascal Compiler Error!

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
matt140
Posts: 4
Joined: Sun Jul 20, 2008 4:23 am

Pascal language - Free Pascal Compiler Error!

Post 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.
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: Pascal language - Free Pascal Compiler Error!

Post by thepowersgang »

What command are you using to compile the kernel?
There should be an option to disable automatic includes in the command line.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
matt140
Posts: 4
Joined: Sun Jul 20, 2008 4:23 am

Re: Pascal language - Free Pascal Compiler Error!

Post 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.
Laksen
Member
Member
Posts: 140
Joined: Fri Nov 09, 2007 3:30 am
Location: Aalborg, Denmark

Re: Pascal language - Free Pascal Compiler Error!

Post 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.
http://j-software.dk | JPasKernel - My Object Pascal kernel
leledumbo
Member
Member
Posts: 103
Joined: Wed Apr 23, 2008 8:46 pm

Re: Pascal language - Free Pascal Compiler Error!

Post by leledumbo »

Don't forget to add {$FPC_IS_SYSTEM} directive or it will still try to add implicit uses System; statement.
Post Reply