gpt4 book ai didi

c++ - MSB6006 : “CL.exe” exited with code 2 when using openMP

转载 作者:行者123 更新时间:2023-12-01 20:11:57 25 4
gpt4 key购买 nike

我尝试在 Visual Studio 中运行一些 openMP 示例,但是当启用/openMP 时,程序无法运行,返回错误“MSB6006:“CL.exe”退出,代码为 2”。这是示例:

int main(int argc, char* argv[]) { 
#pragma omp parallel {
printf("Hello World... from thread = %d\n", omp_get_thread_num());
}
return 0;
}

感谢您的帮助。

最佳答案

当您使用 openMP 时,无法使用“两阶段名称查找”选项。这在输出窗口中有所指示,您可以在其中看到此消息:

1>c1xx:错误 C2338:C++/CLI、C++/CX 或 OpenMP 不支持两阶段名称查找;使用/Zc:twoPhase-

要解决此问题,请转到“项目属性”->“C/C++”->“命令行”,然后在底部的“其他选项”中添加 /Zc:twoPhase-,然后按“确定” 。这解决了我的问题。 enter image description here

关于c++ - MSB6006 : “CL.exe” exited with code 2 when using openMP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57069694/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com