Reputation: 210352
Does anyone know why the following code
void foo(const int X)
{
#pragma omp parallel for private(X)
for (int i = 0; i < 100; i++)
{ }
}
gives this error
error: 'X' is predetermined 'shared' for 'private'
and how I can really make X
private to each thread?
Upvotes: 3
Views: 2321
Reputation: 60452
You are getting an error because X
is constant. Just remove const
and everything should work.
Upvotes: 2