MinGW配置pthread环境(转)

来源:互联网 发布:天猫优质男装品牌知乎 编辑:程序博客网 时间:2024/06/05 23:01

1. 下载资源

从下面的地址下载静态链接库:libpthreadGC2.a

ftp://sourceware.org/pub/pthreads-win32/dll-latest/lib/x86

从下面的地址下载头文件:pthread.h sched.h semaphore.h

ftp://sourceware.org/pub/pthreads-win32/dll-latest/include

2. 配置

将头文件放置到:/user/local/include/pthread
将库文件放置到:/user/local/lib/pthread
在makefile文件中将头文件目录添加到包含路径,将库目录添加到链接路径。

3. 示例

gcc -o test test.c -I/user/local/include/pthread -L/user/local/lib/pthread -lpthreadGC2
0 0
原创粉丝点击