There is a certain structure described in the header file.
typedef struct i_str { int index; #define ERR_N_1 0 int err_n_1; int stat_index; struct { #define STATE_N_1 0 int state_n_1; } state; } i_str
In the main file there is another function that outputs this structure by comparing the index with the error number with the help of some function comp(a, b)
:
void i_str_dump(struct i_str *msg) { if(comp(msg->index , ERR_N_1)) printf("Error_1: %i", msg->err_n_1); if(comp(msg->stat_index, STATE_N_1)) printf("state 1: %i", msg->state.state_n_1); }
And here it is not compiled, the problem is in #define STATE_N_1 0
. For some reason, this define is not perceived by the compiler. How can I access it without changing anything in the header file?
#define STATE_N_1 0
? I didn’t check but maybe define works first in the header file and only then the result is added to the main file ... - ProkletyiPirat#define STATE_N_1 0
? By the way, there, in the header file with a semicolon at the end is not enough. - alexlz