C/C++ error: storage size of ‘tv’ isn’t known错误解决方法
最近在编译移植lwm2m时,有一个获取时间的函数gettimeofday(struct timeval *, struct timezone *);
#include "time.h"
struct timeval tv;
gettimeofday(&tv, NULL);
...
...
编译时,提示错误storage size of ‘tv’ isn’t known,百度这个函数之后,发现函数的头文件不对,应该是
#include "sys/time.h"
struct timeval tv;
gettimeofday(&tv, NULL)