In File api.h i've
#include <stdio.h>
#ifndef API
#define API
struct trytag;
typedef struct trytag try;
void trial (try *);
#endif
In file core.h, i've
#ifndef CORE
#define CORE
struct trytag
{
int a;
int b;
};
#endif
In func.c, i've
#include "api.h"
#include "core.h"
void trial (try *tryvar)
{
tryvar->a = 1;
tryvar->b = 2;
}
In main.c, i've
#include "api.h"
int main ()
{
try s_tryvar;
trial(&s_tryvar);
printf("a = %d\nb = %d\n", s_tryvar.a, s_tryvar.b);
}
When i compile i get main.c:5: error: storage size of ‘s_tryvar’ isn’t known
If i include core.h in main.c this error doesn't come as try is defined in core.h. But I want the structure try to be hidden to main.c. Main.c should not know the members of try structure. What am i missing?