Windows系统下pthread环境配置
来源:互联网 发布:python hmm 编辑:程序博客网 时间:2024/05/29 03:18
记录下win7系统,vc6.0++编译器下配置POSIX多线程环境的步骤。
配置
下载地址 ftp://sourceware.org/pub/pthreads-win32/
我下载的版本是 fpthreads-w32-2-1-0-release.exe 2005/3/16
运行后点Exract,解压完成后再点Done,可以看到三个文件夹,但只需要用到Pre-built.2文件夹。将Pre-built.2/include中的三个头文件复制到vc的Include文件夹内
将Pre-built.2/lib中的8个文件复制到vc的Bin文件夹内(不知道需不需要,反正移就完事了)
将Pre-built.2/lib中的pthreadVC2.lib和pthreadVSE2.lib复制到vc的Lib文件夹里(否则会出现链接错误
LNK1104:cannot open file "pthreadVC2.lib"
)将Pre-built.2/lib中的pthreadVC2.dll文件复制到C:\Windows\system里面(我的电脑中有system和system32两个文件夹,试了下发现应该放在system中)
配置完成,编程的时候需要包含pthread.h头文件,并且要加上一句
#pragma comment(lib, "pthreadVC2.lib")
(否则会出现链接错误)
测试
#include <cstdio>#include <pthread.h>#pragma comment(lib, "pthreadVC2.lib")void * fun(void * arg) { printf("Hello, %s\n", (char *) arg); return NULL;}int main(void) { pthread_t t1, t2; pthread_create(&t1, NULL, fun, "thread1"); pthread_create(&t2, NULL, fun, "thread2"); pthread_join(t1, NULL); pthread_join(t2, NULL); return 0;}
输出结果
Hello, thread1Hello, thread2
阅读全文
0 0
- Windows系统下pthread环境配置
- 在windows下配置pthread
- 在windows下配置pthread
- 在windows下配置pthread
- 在windows下配置pthread
- 在windows下配置pthread
- 在windows下配置pthread
- 在windows下配置pthread
- 在Windows下配置pthread
- 在windows下配置pthread
- vs2010下配置pthread环境详解
- windows 系统下java环境配置
- 在Windows系统下配置TensorFlow环境
- MinGW配置pthread环境
- Windows下使用pthread
- Windows下使用pthread
- windows 下使用 pthread
- Windows下使用pthread
- 对于ajax传值的用法总结
- tensorflow bug: AttributeError: module 'tensorflow' has no attribute 'xxxx'
- 五步之内,必有芳草
- OkHttp框架中拦截器设计精髓之责任链模式
- ie浏览器缓存不能更新页面数据
- Windows系统下pthread环境配置
- Adapter中按比例显示不同高度的图片
- opencv中的PCA降维
- 单链表
- 用openssl编写ssl,tls程序实例
- jmeter链接jdbc 插入数据中文显示问号
- JAVA 数据导出Word文档模板的功能实现
- 如何打包 zeit/micro 程序
- Spark源码分析之Worker启动通信机制