在windows下vs使用pthread
首先从http://sourceware.org/pthreads-win32/下载pthread 的windows安装包,我下的是pthread-w32-2-9-1-release.zip,其他版本也可以。解压到pthread-w32-2-9-1-release。
该目录会多出三个文件夹:Pre-built.2,pthreads.2,QueueUserAPCEx。这里我们主要使用Pre-built.2,里面包含了编译好的lib和dll。
然后添加加库和头文件。
方法1:在工程中添加
1. 在Project ->Pthread_TestProperties -> Configuration Properties-> C/C++ -> General ->AdditionalInclude Directories 中增加头文件路径。
2. 在Project ->Pthread_Test Properties -> ConfigurationProperties-> Linker -> General-> Additional Library Directories 中增加库文件路径。我用的是x86库。
3. 在Project ->Pthread_Test Properties -> ConfigurationProperties-> Linker -> Input ->Additional Dependencies中增加所依赖的库文件。这里我们使用的IDE是VS2010,所以我们使用pthreadVSE2.lib。
如果不在这里添加pthreadVSE2.lib 则在程序中要声明:
#pragma comment(lib, "pthreadVC2.lib")
方法2:将头文件和库添加到vc目录下
其中需要的是Pre-built.2文件夹里面的内容
首先将里面的include文件夹和lib文件夹里面的文件拷到VS安装目录下的include和lib文件夹下
最后配置动态链接库
1. 将把dll下的x64文件夹下的两个文件,即pthreadGC2.dll与pthreadVC2.dll拷贝到C:\Windows\System32下(用于64位程序的运行)
2. 把dll下的x86文件夹下的五个文件,拷贝到C:\Windows\SysWOW64下(用于32位程序的运行),注意一下,千万不能将这些文件拷贝反位置,否则,程序运行时会提示说找不到对应的dll文件
在windows下vs使用pthread的更多相关文章
- windows下静态编译pthread
1. Building the library as a statically linkable library-------------------------------------------- ...
- 在Windows下使用Dev-C++开发基于pthread.h的多线程程序【转】
在Windows下使用Dev-C++开发基于pthread.h的多线程程序[转] 在Windows下使用Dev-C++开发基于pthread.h的多线程程序 文章分类:C++编程 ...
- windows下 DEV-C++无法连接到pthread.h的解决办法
参考的这个博文,原博文有图片:http://lslin.iteye.com/blog/776325 (我只是为了方便写.copy一遍) dev-C++编写C/C++程序时,非常方便轻巧,但是今天学习多 ...
- 在windows下配置pthread
http://blog.csdn.net/qianchenglenger/article/details/16907821 简单介绍windows平台下的pthread线程库
- Windows下POSIX线程编程(pThread)环境搭建
系统: Windows 编辑器:codeblocks13.12 1. 简介: Windows有一个叫 POSIX Threads for Win32 的开源项目给出了一个功能比较完善的Windows下 ...
- 关于 Poco::TCPServer框架 (windows 下使用的是 select模型) 学习笔记.
说明 为何要写这篇文章 ,之前看过阿二的梦想船的<Poco::TCPServer框架解析> http://www.cppblog.com/richbirdandy/archive/2010 ...
- [笔记]linux下和windows下的 创建线程函数
linux下和windows下的 创建线程函数 #ifdef __GNUC__ //Linux #include <pthread.h> #define CreateThreadEx(ti ...
- Linux 和 Windows 下实现多进程的方式以及管道操作
一.多进程 1.windows 多进程 使用 #include<windows.h> 下面的 BOOL CreateProcess( LPCWSTR pszImageName, LPCWS ...
- 完美实现 Windows 下网络通信
编译环境:DEV C++ 配置编译器 Windows 下 实现 Socket 编译需要 ws2_32.lib 这个库的支撑,所以我们编译前应该配置下编译器,具体配置步骤如下: Tools -> ...
随机推荐
- 我推荐的 Java Web 学习路线
晚上再 V2 的 Java 的节点看到有人问 Java Web 书籍推荐.我这半年多的时间,也从别的方向开始转向 Java 服务端开发,所以,我来说下我的学习路线,帮助有需要的朋友把半只脚踏进 Spr ...
- (原创)(三)机器学习笔记之Scikit Learn的线性回归模型初探
一.Scikit Learn中使用estimator三部曲 1. 构造estimator 2. 训练模型:fit 3. 利用模型进行预测:predict 二.模型评价 模型训练好后,度量模型拟合效果的 ...
- LeetCode 606. Construct String from Binary Tree (建立一个二叉树的string)
You need to construct a string consists of parenthesis and integers from a binary tree with the preo ...
- LeetCode 217. Contains Duplicate (包含重复项)
Given an array of integers, find if the array contains any duplicates. Your function should return t ...
- Warning: connect.static is not a function
grunt-contrib-connect从0.11.x版本开始不支持connect.static和connect.directory 你应该安装serve-static(加载静态文件)和serve- ...
- C Run-Time Error R6034问题的解决
1.问题描述 这两天一直在用vs2008编写一个小项目,需要在c++代码中通过命令行的方式调用cl.exe和link.exe,也就是给编译器cl和链接器link传递参数,然后编译链接生成可执行文件ex ...
- Django开发小型站之前期准备(一)
语言:python3.5 工具:JetBrains PyCharm virtualenvwrapper优点: 1.使不同的应用开发环境独立 2.环境升级不影响其他应用,也不会影响全局的python环境 ...
- PHP基础入门(二)【PHP函数基础】
PHP基础入门(二)--函数基础 了解 PHP基础入门详解(一) 后,给大家分享一下PHP的函数基础. 这部分主要讲的就是: 函数的声明与使用.PHP中变量的作用域.静态变量.函数的参数传递.变量函数 ...
- 关于隐藏元素高度的问题 css visibility:hidden 与 display:none的区别
其实这是一个老问题了,s visibility:hidden 与 display:none 共同点就是都会似的元素不可见.但是 visibility:hidden 的DOM元素是占用空间的,会挤占其他 ...
- WebService--jax-spring集成
如果使用javax.jws内容编写webservice,则只能通过将程序打成jar包的形式运行,如果要想通过web容器进行发布,则需要使用其他webservice框架.下面介绍jaxws与spring ...