在VS和QT下配置pthread

在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

 其他问题:https://blog.csdn.net/user11223344abc/article/details/80536280

在qt下配置

首先,qt在windows上有2个版本,即MinGW 和VS版,MinGW没有64位的,只有32位的,而VS(VC++)有64位和32位两个版本。

之前在VS上配置时用的是x64版本,但是在QT上使用x86会比较方便。

参考博客:

https://www.cnblogs.com/findumars/p/6375665.html

https://blog.csdn.net/June_Xixi/article/details/83447954#commentBox

posted @ 2019-04-19 10:02  飘柔的小卷毛  阅读(861)  评论(0编辑  收藏  举报