VS2012下安装和使用Pthread

来源:互联网 发布:演讲培训班有用吗 知乎 编辑:程序博客网 时间:2024/05/20 09:07

官方网站:http://sourceware.org/pthreads-win32/

 1). 下载Windows版本的pthread。目前最新版本是:pthreads-w32-2-8-0-release.exe。主页地址:http://sourceware.org/pthreads-win32/

   2). 双击pthreads-w32-2-8-0-release.exe,会出现解压对话框,"browse"选择指定目录,"extract"解压,"done"完成。

   3). 完成后,该目录会多出三个文件夹:Pre-built.2,pthreads.2,QueueUserAPCEx。这里我们主要使用Pre-built.2,里面包含了编译好的lib和dll。我们需要的头文件和库文件也包含在这个文件夹中。pthreads.2文件夹中包含了源代码。我们也可自行编译需要的库文件。

   4). 新建一个win32控制台程序。命名为Pthread_Test。代码后附。

   5). 在Project -> Pthread_Test Properties -> Configuration Properties -> C/C++ -> General -> Additional Include Directories 中增加头文件路径。

  6). 在Project -> Pthread_Test Properties -> Configuration Properties -> Linker -> General -> Additional Library Directories 中增加库文件路径。

 7). 在Project -> Pthread_Test Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies 中增加所依赖的库文件。这里我们使用的IDE是VS2010,所以我们使用pthreadVSE2.lib。各个库的不同之处在pthreads.2下的README文档中有介绍。

0 1
原创粉丝点击