在VS下配置
参考这篇博客:
https://blog.csdn.net/qianchenglenger/article/details/16907821#commentBox
尝试之后报错:C2011 “timespec”:“struct”类型重定义
这里有解决办法:
https://bbs.csdn.net/topics/391910387?page=1
#if !defined(HAVE_STRUCT_TIMESPEC) #define HAVE_STRUCT_TIMESPEC #if !defined(_TIMESPEC_DEFINED) #define _TIMESPEC_DEFINED struct timespec { time_t tv_sec; long tv_nsec; }; #endif /* _TIMESPEC_DEFINED */ #endif /* HAVE_STRUCT_TIMESPEC */
以上是ptheard.h里的结构体timespec的声明,如果有结构体重名,使用HAVE_STRUCT_TIMESPEC变量即可,在include “ptheard.h”之前,先define这个变量
#define HAVE_STRUCT_TIMESPEC
在qt下配置