Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error C3041
Collapse the table of content
Expand the table of content

Compiler Error C3041

Error Message

'var' : variable in 'copyprivate' clause must be private in enclosing context

A variable passed to copyprivate cannot be shared in the enclosing context.

The following sample generates C3041:

// C3041.cpp
// compile with: /openmp /c
#include "omp.h"
double d;
int main() {
   #pragma omp parallel shared(d)
   // try the following line instead
   // #pragma omp parallel private(d)
      // or don't make d copyprivate
      #pragma omp single copyprivate(d)   // C3041

Community Additions

© 2015 Microsoft