编译器错误 C3012

“intrinsic”: 并行区域内不允许直接使用内部函数

区域内不允许使用 omp parallel 。 若要解决此问题,请将内部函数移出该区域,或将其替换为非内部等效项。

示例

下面的示例生成了 C3012 并演示了修复此错误的一种方法:

// C3012.cpp
// compile with: /openmp
#ifdef __cplusplus
extern "C" {
#endif
void* _ReturnAddress();
#ifdef __cplusplus
}
#endif

int main()
{
   #pragma omp parallel
   {
      _ReturnAddress();   // C3012
   }
   _ReturnAddress();      // OK
}