MinGW配置pthread环境

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


你可能感兴趣的:(pthread,MinGW)