在VC6.0和VS2010下编译pthreads-w32-2-8-0-release.exe
来源:互联网 发布:baocms源码下载 编辑:程序博客网 时间:2024/05/17 04:30
- <span style="font-family: Arial, Verdana, sans-serif; white-space: normal; ">1.下载pthreads-w32-2-8-0-release.exe</span>
- <span style="font-family: Arial, Verdana, sans-serif; white-space: normal; ">1.下载pthreads-w32-2-8-0-release.exe</span>
下载地址:ftp://sourceware.org/pub/pthreads-win32
2. 安装pthreads-w32-2-8-0-release.exe
双击pthreads-w32-2-8-0-release.exe,点击Browse选择安装到的目录,然后点击Extract解压,完成后点击Done。
之后会在安装目录看到有三个文件夹Pre-built.2、pthreads.2、QueueUserAPCEx.
第一个是生成库(头文件和库文件那些),第二个是源码,第三个不清楚,像是测试程序。
将Pre-built.2文件夹下的include和lib文件夹里的文件复制到VS2008对应的include和lib目录,我这里是C:\Program Files\Microsoft Visual Studio 9.0\VC\include和C:\Program Files\Microsoft VisualStudio 9.0\VC\lib.
3. 编写测试程序
- #include<stdio.h>
- #include<pthread.h>
- #include<Windows.h>
- #pragmacomment(lib, "pthreadVC2.lib") //必须加上这句
- void*Function_t(void* Param)
- {
- pthread_t myid = pthread_self();
- while(1)
- {
- printf("线程ID=%d \n", myid);
- Sleep(4000);
- }
- return NULL;
- }
- int main()
- {
- pthread_t pid;
- pthread_create(&pid, NULL, Function_t,NULL);
- while (1)
- {
- printf("in fatherprocess!\n");
- Sleep(2000);
- }
- getchar();
- return 1;
- }
和Linux的pthread一样~直接编译运行就ok了。如果运行提示缺少pthreadVC2.dll,就将Pre-built.2\lib目录下的pthreadVC2.dll拷贝到可执行文件所在目录就行了
http://blog.csdn.net/w_ww_w/article/details/6725182
- 在VC6.0和VS2010下编译pthreads-w32-2-8-0-release.exe
- 在VC6.0和VS2010下编译pthreads-w32-2-8-0-release
- 在VC6.0和VS2010下编译pthreads-w32-2-8-0-release
- Windows上VS使用pthread重温经典多线程卖票(pthreads-w32-2-8-0-release.exe)(windows上使用pthread.h)
- VC6.0在Windows7下编译问题:Error spawning cl.exe
- vc6.0如何在Release模式下调试
- VC6.0在Release下调试的设置
- VC6.0 debug 和 release
- VS2010下编译的库在VC6下使用问题
- 转:在vc6.0下编译vtk
- GlobalMemoryStatusEx()在VC6.0下的编译
- VC6.0下编译
- vc6.0下使用release版本调试
- const 在VC6.0 和 VS2010 中异同
- 在VC6下编译和安装STLport
- VC6.0 DEBUG RELEASE
- vs2010 下release编译的时候出现问题:_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”
- VC6.0在Release版本下如何调试——转载
- udp和tcp
- 【转】尚学堂shopping的经验
- android 中wifi的应用
- unidac连接firebird的embed版
- android之帧动画实现
- 在VC6.0和VS2010下编译pthreads-w32-2-8-0-release.exe
- SAP笔试
- 首次正式测试之后
- opencv静态库的创建
- Java设计模式之工厂方法模式
- 判断单链表是否有环及确定环的入口结点问题
- 追求“纯粹的技术”的误区
- 游戏外挂基本原理及实现
- 模板类