In a member function, I can parallelize using the shared member variable int *x like this

#pragma omp parallel for default(shared)
for(int i=0;i<size;i++) {
  x[i]=i;
}

But if I try

#pragma omp parallel for default(none) shared(x,size)
for(int i=0;i<size;i++) {
  x[i]=i;
}

I get the error: 'obj::x' is not a variable in clause 'shared'. I would prefer the second version because it announces the shared variables it is working with, reminding me to make sure there are no race conditions or similar problems.

What is going on that OpenMP claims that obj::x is not a variable?

Edit
Report