Can I get Unix's pthread.h to compile in Windows?

后端 未结 5 835
囚心锁ツ
囚心锁ツ 2020-11-27 17:14

If I try to compile a program with

#include 

in it, I get the error:

pthread.h: No such file or directory
         


        
5条回答
  •  孤城傲影
    2020-11-27 17:41

    pthread.h is a header for the Unix/Linux (POSIX) API for threads. A POSIX layer such as Cygwin would probably compile an app with #include .

    The native Windows threading API is exposed via #include and it works slightly differently to Linux's threading.

    Still, there's a replacement "glue" library maintained at http://sourceware.org/pthreads-win32/ ; note that it has some slight incompatibilities with MinGW/VS (e.g. see here).

提交回复
热议问题