- 在.pro文件中加入
QMAKE_CXXFLAGS+=/openmp
- main.cpp
<pre>
include <iostream>
include <omp.h>
int main()
{
ifndef _OPENMP
fprintf(stderr, "OpenMP not supported");
endif
pragma omp parallel for
for (char i = 'a'; i <= 'z'; i++)
std::cout << i ;
//std::cout<<omp_get_num_threads()<<std::endl;
return 0;
}
</pre>