Archived

This topic is now archived and is closed to further replies.

smitty1276

Error in math.h?!?

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites