Compiler Error C3037
'var' : variable in 'reduction' clause must be shared in enclosing context
A variable specified in a reduction clause may not be private to each thread in the context.
The following sample generates C3037:
// C3037.cpp
// compile with: /openmp /c
int g_i;
int main() {
int i;
#pragma omp parallel private(g_i)
// try the following line instead
// #pragma omp parallel
{
#pragma omp for reduction(+:g_i) // C3037
for (i = 0 ; i < 10 ; ++i) {
g_i += i;
}
}
}