Edit

Share via


Compiler Error C3058

'symbol' : symbol not declared as 'threadprivate' before it is used in the 'copyin' clause

A symbol must first be declared threadprivate before it can be used in a copyin clause.

The following sample generates C3058:

// C3058.cpp
// compile with: /openmp
int x, y, z;
#pragma omp threadprivate(x, z)

void test() {
   #pragma omp parallel copyin(x, y)   // C3058
   {
   }
}

Possible resolution:

// C3058b.cpp
// compile with: /openmp /LD
int x, y, z;
#pragma omp threadprivate(x, y)

void test() {
   #pragma omp parallel copyin(x, y)
   {
   }
}