Reputation: 121
I am confused by my actual problem... Could also be my mistake
Short description with code:
rtc.h
#ifndef RTC_H_
#define RTC_H_
typedef struct timestamp_t
{
uint8_t year,month,day,hour,minute,second;
}timestamp_t;
#endif /* RTC_H_ */
lpwa.h
#ifndef LPWA_H_
#define LPWA_H_
#include "rtc.h"
timestamp_t lpwa_ntp_to_stamp(char*); //shows error: unknown name timestamp_t
#endif /* LPWA_H_ */
lpwa.c
#include "lpwa.h"
timestamp_t lpwa_ntp_to_stamp(char *text) //no problem
{
...
}
If I copy the typedef struct to lpwa.h it says "confliction types for timestamp_t"
Am I missing something or is this just not possible?
Upvotes: 2
Views: 163
Reputation: 150
This is an answer compiled from my debugging recommendations which helped OP to find the actual problem:
#error Header A is compiled
#error Header B is compiled
generously in all likely and unlikely places of your project will give you an idea of the actual include tree, allowing you to look for differences to the imagined include tree. (Use #warning
if your compiler supports it, then you get more than only the first #error
encountered.)#error
will also alert you of the possible problem that you look at different files (e.g. in your editor) than the compiler actually processes. (Again, not mocking. That happens more often, to me, than I'd like to admit....)Above is general.
Specifically in your case, I suspect that there is a hidden/indirect #include "lwpa.h"
inside rtc.h, between the shown include and the shown typedef. (And I think you confirmed that.)
Upvotes: 4