im getting a “storage size of ‘data’ isn’t known” when i try to use a certain struct.
Code:
ioHelper.h:
#ifndef IOHELPER_H_
#define IOHELPER_H_
typedef struct fileValues data;
struct fileValues ioInput(FILE* file,int dim,int sign);
#endif /* IOHELPER_H_ */
ioHelper.c:
struct fileValues
{
int dim;
char sign;
double x;
double y;
};
map.c:
void drawData(FILE* vectors)
{
double paramLoc [MAX_DIMENSION];
char sign;
(this is where i get the error) struct fileValues data;
...
}
any ideas?
This is because when compiling map.c the compiler can’t see the full definition of the struct in IoHelper.c.
You probably only included IoHelper.h, which has the (incomplete) declaration, not the definition.
So you cannot declare a variable of that struct type inside of map.c unless you