|
-
July 16th, 1999, 11:33 AM
#1
#ifdef's and #include's
Can someone please explain to me why you can't have #include statements within a #ifdef #else # endif conditional structure in Microsoft C++ ver. 6.0?
example:
#ifdef LEGACY_CODE
#include "first.h"
#include "second.h"
#else
#include "third.h"
#include "fourth.h"
#endif
The compiler gives the error 'fatal error C1020: unexpected #else'.
This is the first time I attempted to do this so I am not sure if this is just MS compilers or all C++ compilers in general.
-
July 16th, 1999, 12:08 PM
#2
Re: #ifdef's and #include's
I can't see anything wrong with what you have posted.
Maybe there is a problem in one of the other header files.
-
July 17th, 1999, 06:20 AM
#3
Re: #ifdef's and #include's
Hi
There is nothing wrong there. Please check out ur code one. It may be giving that problem due to some other bug.
Srini.
Srinidhi Rao
-
July 17th, 1999, 08:02 AM
#4
Re: #ifdef's and #include's
Are the 4 header files in your project? If not that might be what is causing the error. I have used conditional assemblies like this with NO errors.
Roger L. McElfresh
-
July 17th, 1999, 11:27 AM
#5
Re: #ifdef's and #include's
I'm pity to tell you I suppose your header file: first.h or second.h, maybe some nest error.
And, I can almost ensure that error is in second.h.
So, check the header file, to ensure it's no any error, just like:
#ifndef __second_h
#define __second_h
//...
#endif//__second_h
#endif//ERROR!
//END OF FILE
Notice that no matched #ifdef above it.
So, good lucky!
FlyingYe
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|