bad line in /usr/include/math.h

Issac Trotts trotts@MIT.EDU
Thu Jul 20 19:14:00 GMT 2000


I got a very cryptic error message while compiling a C++ class library
called GiNaC ( http://www.ginac.de/ ) that overloads the function log2 
because of the following sinister line in /usr/include/math.h:

#define log2(x) (log(x) / M_LOG2_E)

I first tried to replace the line with inline versions of log2 for float
and double but
the compiler complained that log2 was being redefined.  So I changed the line
to

#ifdef __cplusplus
// Do not define log2
#else
#define log2(x) (log(x) / M_LOG2_E)
#endif

and now the code compiles.  Btw, I also put the following code:

#ifdef log2
#undef log2
#endif

above the line

unsigned log2(unsigned n); 

in the GiNaC header file that originally had the problem, just in case
I get another infected math.h file later on.

-Issac




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list