Does pgcc support pthreads ?

I’m trying to compile a simple c program that uses pthreads.

I get the following error:

PGI$ pgcc -lpthread hello-pthreads.c
PGC-F-0206-Can’t find include file pthread.h (hello-pthreads.c: 9)
PGC/x86-64 Windows 8.0-2: compilation aborted
PGI$

Does pgcc support pthreads ?

Hi koontz,

Unfortunately Microsoft does not support pthreads on Windows (pthreads is an OS library, not a PGI library). You will either need to use WinSock (Microsoft’s threading library), OpenMP, or switch to Microsoft’s UNIX like environment SUA (subsystems for UNIX applications).

  • Mat

Mat

Thanks

I understand what your saying, but what I don’t understand is:

I can compile the code in Microsoft Windows using the gcc compiler and that works ?

Terry

Hi Terry,

Which gcc are you using? There is third party Win32 port of pthreads (http://sourceware.org/pthreads-win32/) which I think MinGW might include (or at least can be used with MinGW). While I have not tried pthreads-win32 myself, it might work with our 32-bit compilers as well but obviously not the 64-bit compilers. Also, I believe Cygwin offers pthread support but it’s not native Windows and is 32-bit only (at least from what I remember).

  • Mat