math.h

Phil Winninghoff plug-devel@lists.PLUG.phoenix.az.us
Sun May 18 19:03:02 2003


This is a multi-part message in MIME format.

------=_NextPart_000_0005_01C31D69.1A7124A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I just started a project using GNU gcc that requires some rotation of =
graphics. The following snippet will not compile using either Debian 2.2 =
or Red Hat 9:

#include <stdio.h>
#include <math.h>

int main() {
  float x, y, xp, yp, a;
  x =3D 100.0; y =3D 70.0; a=3D0.95;
  xp =3D (x*cos(a)) - (y*sin(a));
  yp =3D (x*sin(a)) + (y*cos(a));
  printf("xp =3D %f\nyp =3D %f\n", xp, yp);
  return 0;
}

It compiles using Borland Turbo C++ under MD-DOS.=20
The gcc GNU compiler tells me it can not find either the sin() or cos() =
functions.
Can anyone give me some help?





------=_NextPart_000_0005_01C31D69.1A7124A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2726.2500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I just started a project using GNU gcc =
that=20
requires some rotation of graphics. The following snippet</FONT><FONT =
face=3DArial=20
size=3D2>&nbsp;will not compile using either Debian 2.2 or Red Hat =
9:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>#include &lt;stdio.h&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>#include &lt;math.h&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>int main() {</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; float x, y, xp, yp, a;<BR>&nbsp; =
x =3D 100.0;=20
y =3D 70.0; a=3D0.95;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; xp =3D (x*cos(a)) - =
(y*sin(a));</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; yp =3D (x*sin(a)) + =
(y*cos(a));<BR>&nbsp;=20
printf("xp =3D %f\nyp =3D %f\n", xp, yp);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; return 0;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>It compiles using Borland Turbo C++ =
under MD-DOS.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>The gcc GNU compiler tells me it can =
not find=20
either the sin() or cos() functions.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Can anyone give me some =
help?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0005_01C31D69.1A7124A0--