[fpc-pascal]How to use the math unit.

Jonas Maebe jonas at zeus.rug.ac.be
Mon Apr 8 11:13:59 CEST 2002


On Sat, 6 Apr 2002, Sigurd Stordal wrote:

> I have a program were I use the math unit, but I get a "access violation",
> and an "unhandled exeption" errors.

Try compiling your program with the -ghl command line options, then you
will get info about where in your program the crash occurs.

> It's an unit, but when I used the float
> type, it gives an "identifier not found: Float". Shouldn't it find it when i
> have a uses math?

Yes, it should. I've just checked and the float type is indeed declared in
the math unit, so I'm not sure why you are getting this error.

> I suppose there are some compiler switches I have to use, but I don't know
> which.

Since the math unit is a Delphi-style unit and uses exceptions, you should
use either -Sd (Delphi compatible) or -S2 (ObjPas = FPC-style) and add the
"sysutils" unit to your uses clause. Can you maybe post a small example
that causes problems? (this always helps if you have a problem and
increases the likelyhood of getting (useful) answers)


Jonas





More information about the fpc-pascal mailing list