Hello,
is there a way to have the code organized like this, such that the s32 doesn't generate errors? The error reported will be
Symbol 'INCREMENT_STEP' could not be resolved.
<<<main.c>>>
#ifndef MAIN_C_
#define MAIN_C_
#include "main.h"
int main(void) {
uint8_t counter;
while(1) {
counter += INCREMENT_STEP;
}
}
#endif // #ifndef MAIN_C_
<<<main.h>>>
#ifndef MAIN_H_
#define MAIN_H_
//global constant
#define GLOBAL 10
#ifdef MAIN_C_
//private constants
#define INCREMENT_STEP 2
#endif // #ifdef MAIN_C_
#endif // #ifndef MAIN_H_
This is a legit code which will get built successfully, but the s32 will report an error since its "live compiler" isn't aware that the MAIN_C_ will be defined when main.c includes main.h. I don't want to suppress all errors, and I don't like suppressing all "symbol could not be resolved" errors. I know I can use #pragma for inline error suppression, but that would make the code messy. Any alternatives?