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

Does the #ifndef to prevent recursive inclusion actually work ?

I am experimenting with the Keil MDK-ARM toolchain (the free version), and an STM32F407 Discovery board.
So far so good, were it not for a small problem. My background is with Embarcadero RAD Studio C++Builder, and with it I often use these starting lines in a header file :

#ifndef __THIS_HEADER
 #define __THIS_HEADER
.....
 float myarray[128];
#endif

This to prevent that including this header in more than one source file causes an
error of multiple definition of the variable myarray.

If I do the same with the uVision compiler, the linker complains loudly about
myarray being multiple defined...

Does the uVision compiler behaves differently than the RAD Studio compiler ?

Thanks,

-Fred

Parents Reply Children
No data