program MouseInput;
Uses WinCrt,Mouse, sysutils,Graph;
Var
GraphicsDriver, GraphicsMode,
ErrCode : smallint;
x, y: word;
Begin
x:=GetMouseX;
Y:=GetMouseY;
Writeln('Initialising Graphics, please wait...');
GraphicsDriver := Detect;
InitGraph(GraphicsDriver, GraphicsMode,'');
x := GetmouseX();
y := GetmouseY();
OuttextXY(0,0,inttostr(x));
readln();
end.
i have this code, but this syntax error occurs:
1 / 1 mouse.pas
Fatal: Syntax error, UNIT expected but PROGRAM found
but this is a program not a unit ?
if i change Mouse to WinMouse it goes away, but throws out other errors saying identifier not found GETMOUSEX and GETMOUSEY
If you look in the folder units/rtl, you will find the unit files ‘mouse.o’ and ‘mouse.ppu’. I think there is a conflict between the file names, because the compiler expects another unit file to update these. By changing the name of your file to ‘mousetest.pas’ the compiler did everything fine.