共用方式為


編譯器錯誤 C3056

'symbol': 符號和 'threadprivate' 指示詞不在同一個範圍內

備註

threadprivate 子句中所使用的符號必須與 threadprivate 子句位於相同的範圍中。

Example

下列範例會產生 C3056:

// C3056.cpp
// compile with: /openmp
int x, y;
void test() {
   #pragma omp threadprivate(x, y)   // C3056
   #pragma omp parallel copyin(x, y)
   {
      x = y;
   }
}

可能的解決方式:

// C3056b.cpp
// compile with: /openmp /LD
int x, y;
#pragma omp threadprivate(x, y)
void test() {
   #pragma omp parallel copyin(x, y)
   {
      x = y;
   }
}