Compiler Error C3059
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3059.
var' : 'threadprivate' symbol cannot be used in the 'clause' clause
A threadprivate symbol was used in a clause.
The following sample generates C3059:
// 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;
}
}
Possible resolution:
// C3059b.cpp
// compile with: /openmp
#include "omp.h"
int x = 0, y = 0;
int main() {
#pragma omp parallel firstprivate(y) private(x)
{
x = y;
}
}
Show: