Error with gd.bi & crt/math.bi

General FreeBASIC programming questions.
markem
Posts: 44
Joined: Aug 30, 2006 23:17
Contact:

Error with gd.bi & crt/math.bi

Postby markem » May 07, 2019 20:49

I decided to do a little programming with FreeBasic. So I downloaded it, installed it, and got out one of my old programs. Imagine my surprise when it got an error. The error was "unexpected identifier". Ok, took a while but I finally tracked it down.

It turns out that gd.bi has a define in it:

#define M_PI 3.14159265 (and so on)

It turns out in the C library there is a similar define - only it is a constant:

const M_PI 3.14159265 (and so no)

The answer is: Put a #ifndef around the gd.bi instance like so:

#ifndef M_PI
#define M_PI 3.14159265 (and so on)
#endif

Thank you - only took me about four hours to figure this out. :-)

Return to “General”

Who is online

Users browsing this forum: No registered users and 7 guests