且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Windows中使用MinGW的CLion中的C项目中使用pthread头文件

更新时间:2023-11-09 11:13:10

我终于想出了一个解决方案.由于我使用的是 MinGW,因此我使用了 MinGW 安装管理器并安装了需要在 CLion 中执行 pthreads 和 openmp 相关任务的软件包.这是程序.

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

打开安装管理器后,进入所有包,选择使用 mingw32-pthreads-w32 命名的包并选择它们进行安装.

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

然后转到安装 -> 应用更改以安装新软件包.您可以在 c 或 c++ 程序中使用 pthread.h 和 omp.h,没有任何问题.

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