How to set up pthreads on windows?

For Visual C++ Users (not MingW), follow this steps:

1) download "ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip"

2) in the extraction folder, open the subfolder "Pre-built.2" and you should see the following files:

  • "Pre-built.2\dll\x64\pthreadVC2.dll" OR "Pre-built.2\dll\x86\pthreadVC2.dll"
  • "Pre-built.2\lib\x64\pthreadVC2.lib" OR "Pre-built.2\lib\x86\pthreadVC2.lib"
  • "Pre-built.2\include\pthread.h"
  • "Pre-built.2\include\sched.h"
  • "Pre-built.2\include\semaphore.h"

3) For Visual Studio C++ x64 projects, go to project properties and add the following paths accordingly:

  • Additional lib Files add "yourpath\Pre-built.2\lib\x64\"
  • Additional dll files add "yourpath\Pre-built.2\dll\x64\"
  • Additional include files add "yourpath\Pre-built.2\include\"

Choose the correct files according to your project build (x64 or x86).


The .dll can go in any directory listed in your PATH environment variable.

The .lib file can go in any directory listed in your LIB environment variable.

The .h files can go in any directory listed in your INCLUDE environment variable.

Also see the FAQs page of the link you shared .

Read Q6, Q7, Q8.