Search code examples
cpthreads

How to use pthread header file in C project in CLion which uses MinGW in windows


I am trying to include #include <pthread.h> in my project which uses CLion but I am cannot use it directly. Is there any specific way to include pthread to a C project?


Solution

  • I finally came up with a solution. Since I am using MinGW I used MinGW installation manager and installed packages that need to execute pthreads and openmp-related tasks in CLion. Here is the procedure.

    After opening the installation manager go to all packages and select the select packages named using mingw32-pthreads-w32 and select them for installation.

    enter image description here

    Then go to the installation -> Apply changes to install new packages. The you can use pthread.h and omp.h inside your c or c++ program without any problem.