Error in math.h?!?

Started by
6 comments, last by smitty1276 20 years, 7 months ago
Here''s the deal, in a nutshell... When I build my project, which is very small and I just started, I get 3 errors... d:\ms visual studio\vc98\include\math.h(310) : error C2143: syntax error : missing '')'' before ''constant'' d:\ms visual studio\vc98\include\math.h(310) : error C2143: syntax error : missing '';'' before ''constant'' d:\ms visual studio\vc98\include\math.h(310) : fatal error C1004: unexpected end of file found I thought it may be a syntax error, elsewhere, but when I remove math.h and all references to the very few objects that use it so far, it compiles and runs fine. Anyone ever had a similar problem? Running VC++ 6.0 on WinXP Pro.
Advertisement
look for a missing semi color or an extra ending brace. . .
It''s probably an error somewhere in something that happens before math.h, such as one of your includes or declarations, or possibly in something you #define (or even -Define on the command line)

Move the #include of <math.h> to the very first line of your file, and see if the error moves to elsewhere -- if that''s the case, then you can use selective #if 0 to zero in on where the problem is.
I already checked all of the syntax...

I did find it though... it was indeed a #define. Apparantly _X, _Y, and _Z are already defined in math.h... sucks, huh?

quote:Original post by smitty1276
I already checked all of the syntax...

I did find it though... it was indeed a #define. Apparantly _X, _Y, and _Z are already defined in math.h... sucks, huh?



Generally you shouldn''t begin your custom defines with an underscore as (IIRC) underscored defines are reserved for either standard usage or for implimentation specific defines.

Colin Jeanne | Invader''s Realm
Actually, _X and _Y are used for arguments in a lot of the inline functions in math.h. My having it defined as 0, 1, 2 for _X, _Y, and _Z was causing some problems.
#ifndef
#define
#elseif
But you should check if everything went the first branch .............

______________________________
Madman
______________________________Madman
quote:Original post by smitty1276
I already checked all of the syntax...

I did find it though... it was indeed a #define. Apparantly _X, _Y, and _Z are already defined in math.h... sucks, huh?



Underscores followed by a capital letter are reserved for the implementation. A pedantic compiler sh/would reject all such user code.

_z is technically OK to use, but doesn''t fit the MACRO rule. Does you project have a prefix? Use PREFIX_Z etc...
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement