【问题标题】:Why might the “fatal error C1001” error occur intermittently when using openmp?为什么使用openmp时会间歇性出现“fatal error C1001”错误?
【发布时间】:2015-02-11 07:16:43
【问题描述】:
我的代码在没有#openmp 的情况下运行良好
但是当我添加#openmp 编译器时出现此错误
1>c:\users\hdd amd ali\documents\v studio 10 projects\visual studio 2010\projects\escaledesvols2 - copy\escaledesvols2\djikstra.cpp(116):致命错误 C1001:内部错误发生在编译器。
1> (编译器文件'f:\dd\vctools\compiler\utc\src\p2\wvm\mdmiscw.c', ligne 1098)
注意:
我使用许多不同的库(如#boost)
#include <string>
#include <iostream>
#include <stdio.h>
#include <ctime>
#include <iomanip>
#include <sstream>
#include <msclr\marshal_cppstd.h> // for unmanaged piece of code
#include <vcclr.h>
【问题讨论】:
标签:
c++
visual-studio-2010
boost
openmp
【解决方案1】:
我最近遇到了这个问题;我正在使用 Visual Studio 2015 进行编译。我使用 Visual Studio 2017 进行了尝试,但仍然出现内部编译器错误。然后我用 Visual Studio 2013 进行了尝试,它告诉我在 openMP 部分中不能有“return”语句。当我从 VS 2013 和 VS 2105 中删除返回时,编译器能够成功编译。因此,用 VS 2013 尝试它是有意义的,它会给你一个更好的错误描述。您也可能在 openMP 部分中有 return 语句,这可能是 c1001 错误的原因。
【解决方案2】:
在我的例子中,它是来自 OpenMP 循环的返回函数。删除“return”行解决了这个问题。
【解决方案3】:
你应该简单地报告它。
就解决方法而言,它可能与内存/资源消耗有关。降低消耗的常用技巧是
- 禁用调试信息
- 将编译单元拆分为更小的尺寸(这可能是这里的关键:“我正在使用许多库”应该不是问题,除非您将所有标题都包含在一个翻译单元中
- 尽量减少模板实例化
或者
- 减少系统负载(关闭可能占用宝贵资源的其他程序,例如 Stackoverflow 浏览器 :))