直接开整!
具体步骤
步骤一:创建项目
新建 C++ 空项目,添加一个 Cpp 文件,内容如下:
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
#pragma omp parallel
{
printf("the number of thread = %d\n", omp_get_thread_num());
}
}
步骤二:修改项目配置
右击项目属性,修改红框中的参数:

运行程序,便可以打印CPU的最大线程数量。
