OpenMP错误:'私有'预定'共享''X'

时间:2011-04-02 20:34:26

标签: c openmp

有谁知道为什么以下代码

void foo(const int X)
{
    #pragma omp parallel for private(X)
    for (int i = 0; i < 100; i++)
    {  }
}

发出此错误

  

错误:'X'预定'共享'为'私人'

以及如何让X对每个帖子都私有?

1 个答案:

答案 0 :(得分:4)

您收到错误,因为X是常量。只需删除const,一切都应该有效。

相关问题