Re: Programming with gtkmm: problem with Arcs and Circles, Clock examples



Marko Anastasov schrieb:
У пет, 27. 04 2007. у 11:38 -0500, Jonathon Jongsma пише:
On 4/27/07, Wenzel <wgwenzel t-online de> wrote:
The example applications "Drawing Arcs and Circles" and "Creating a
Clock with Cairo" won't compile (under Windows XP, only !?).

"M_PI" isn't defined.

Inserting "#define pi 3.14159265359" (compare
http://www.gtkmm.org/docs/gtkmm-2.4/examples/gdk/radar.cc)
or - more C++ish - "const double pi = 3.14159265359;" fixes this issue.
I was under the impression that M_PI was pretty standard.  Is it just
a matter of a missing include (i.e. does it work if you explicitly
include <cmath>)?  Or alternately what about changing it from M_PI to
G_PI (which is defined by glib I believe, so should be available on
windows and linux)


I searched a bit now, M_PI is definitely not part of the C standard [1].
So G_PI is preferred then.

Marko

[1] http://c-faq.com/fp/mpi.html

Including "(c)math(.h)" doesn't do. Neither Microsoft's nor GCC's math include files define pi.

But changing "M_PI" to "G_PI" works fine.

Thank you for your vivid response.

Werner Wenzel





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]