Freigeben über


Compilerfehler C3059

"Var": Ein threadprivate-Symbol kann nicht in der -Klausel verwendet werden.

Ein threadprivate Symbol wurde in einer Klausel verwendet.

Im folgenden Beispiel wird C3059 generiert.

// C3059.cpp
// compile with: /openmp
#include "omp.h"
int x, y;
#pragma omp threadprivate(x, y)

int main() {
   #pragma omp parallel private(x, y)   // C3059
   {
      x = y;
   }
}

Mögliche Lösung:

// C3059b.cpp
// compile with: /openmp
#include "omp.h"
int x = 0, y = 0;

int main() {
   #pragma omp parallel firstprivate(y) private(x)
   {
      x = y;
   }
}