我遇到了以下代码的错误(error.cpp):
#include <map>
#include <functional>
#include <vector>
int main()
{
std::map<
int, std::map< std::string,
std::map<std::string, std::map<std::string, std::map<std::string,
std::map<std::string, std::map<std::string, std::map<std::string,
std::map<std::string, std::map<std::string, std::map<std::string,
std::map<std::string, std::map<std::string, std::map<std::string,
std::map<std::string, std::map<std::string, std::map<std::string,
std::map<std::string, std::map<std::string, std::map<std::string,
std::map<std::string, std::string>
> > >
> > >
> > >
> > >
> > >
> > >
> > oups;
}
在使用调试标志进行编译时:
g++ error.cpp -g -o error
我的系统是运行在虚拟机上的Ubuntu 18.04版本,使用的编译器为g++ 7.5.0版本。RAM内存大小为5GB,Swap空间大小为2.5GB,硬盘剩余空间只有1GB。
这种情况正常吗?是个bug吗?还是有限制?
针对以上代码,(c++14)有什么更好的替代方案?
fatal error C1060: compiler is out of heap space
的翻译:致命错误!编译器已用完堆空间。 - Retired Ninja