Hi trying to port some code and I'm not understanding the problem here,
getting the error - file.c:370:17: error: variable has incomplete type 'struct stat'
here is the code that is throwing up the error
int srcfd, destfd;
int nread;
char ifc[PROPERTY_VALUE_MAX];
char *pbuf;
char *sptr;
struct stat sb;
if (stat(config_file, &sb) != 0)
return -1;
pbuf = malloc(sb.st_size + PROPERTY_VALUE_MAX);
if (!pbuf)
return 0;
i've read various stackoverflow questions regarding incomplete types and defining in header files, but i don't understand how to implement any of that. i've tried moving the function about, declaring it in a header file and outside the function . but get the same error.