This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C252 and #if statements

I have a header file that will be compiled by multiple different compilers. This being the case, I want to use #if statements to change the compilation flow based on the current compiler. In the Keil compiler case, I want to use the #pragma NOIV to disable vector table generation, so I used the following at the beginning of the file:

#if(__C51__)

/* some comment */
#pragma NOIV

#endif /* end __C51__ */

I received the C252 error about misplaced control lines. Looking at the documentation, blank lines and comment lines should be ignored, so I would expect what I have written to work, since the pre-processor should remove or add the pragma before the compiler is invoked. Is this case, or is it impossible to use control lines with #if statements?

Thanks, Ian.

Parents Reply Children