We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello together,
I'm coding a simple UART-Application on the MCBSTM32 eval board and have problems with the preprocessor directives. I studied the whole documentation here and I'm pretty sure I'm coding in a common way, but still I can't compile my program. These are the very first lines of my main header file:
#ifndef ___MAIN_H_ #define ___MAIN_H_ #endif #undef EX #ifndef ___MAIN_C_ #define EX extern #else #define EX #endif
And my variables a coded that way:
EX unsigned int ui_TxFrameCounter;
When compiling the program, I get the error code "L6200E: symbol multiply defined" for my variables, because of including the header to other files. I want to declare the variables "extern" for the other header files. Could somebody help me? Would be nice. Geetings
Of course I defined in the "MAIN_C_" in the "main.c" file. And you are right with the underscores. In my initial version I tried it without underscores, but without success. That's why I simply tried it this way. But now I removed them again.
In my opinion the problem comes from the "#define" statement. In the following code line the key word "extern" isn't marked bold in the IDE:
#ifndef MAIN_C_ #define EX extern #else #define EX #endif
Normally the key word "extern" is displayed as bold text. When I remove the "#define" statement, it is bold again. This is for me an indicator, that there is something wrong. Another question by the way: Is German also accepted? ;) Greetings