June 08, 2005 Preprocessor error: '#endif' found without '#if' | ||||
---|---|---|---|---|
| ||||
I've got a bit of a request. Whenever I have an #endif somewhere with no matching #if/#ifdef, DMC gives an error like this: #endif ^ tdpolygs.h(2700) : Preprocessor error: '#endif' found without '#if' Line 2698-2700: #else #include "polygs2.h" #endif Before those there's an #ifndef OLDPOLY3D line, and lots of code which gets skipped because I'm working on the function in another (temporary) file - polygs2.h. The actual cause of the error is that on line 150 of polygs2.h, I have an #endif which I missed when I deleted its #ifdef and #else. The problem is, it'd be pretty hard to track down that #endif with just what DMC tells me. Luckily, since I've ported this DOS program to windows without forking the source, I can tell BC 3.1 to compile it for DOS, and it'll hit the same problem. Why would I do that? Because BC 3.1 gives this error message instead: Error polygs2.h 150: Misplaced endif directive in function poly3d(float *,float *,float *,unsigned int,unsigned char) Which is exactly where I need to go to find that errant #endif. I'd love to see DMC do like BC 3.1 and give the line number of the actual cause. But I have a feeling this wouldn't be easy to implement. -SL |
June 14, 2005 Re: Preprocessor error: '#endif' found without '#if' | ||||
---|---|---|---|---|
| ||||
Posted in reply to SL | Seconded "SL" <shadowlord13@gmail.com> wrote in message news:d87urk$2t7j$1@digitaldaemon.com... > I've got a bit of a request. Whenever I have an #endif somewhere > with no matching #if/#ifdef, DMC gives an error like this: > #endif > ^ > tdpolygs.h(2700) : Preprocessor error: '#endif' found without > '#if' > > Line 2698-2700: > #else > #include "polygs2.h" > #endif > > Before those there's an #ifndef OLDPOLY3D line, and lots of code which gets skipped because I'm working on the function in another (temporary) file - polygs2.h. > > The actual cause of the error is that on line 150 of polygs2.h, I have an #endif which I missed when I deleted its #ifdef and #else. > > The problem is, it'd be pretty hard to track down that #endif with just what DMC tells me. Luckily, since I've ported this DOS program to windows without forking the source, I can tell BC 3.1 to compile it for DOS, and it'll hit the same problem. Why would I do that? Because BC 3.1 gives this error message instead: > > Error polygs2.h 150: Misplaced endif directive in function > poly3d(float *,float > *,float *,unsigned int,unsigned char) > > Which is exactly where I need to go to find that errant #endif. > > I'd love to see DMC do like BC 3.1 and give the line number of the actual cause. But I have a feeling this wouldn't be easy to implement. > > -SL |
Copyright © 1999-2021 by the D Language Foundation