我正在尝试编译一个简单的 C++ 文件,它可以:
static const unsigned char content[] =
{
// 29MB of data written as "0x1E, 0x83, 0x3E, 0x86, 0xC8, 0x80, ...". 10 values per line
};
要编译的文件有近 3M 行,大约 200Mo
这是资源管理系统的输出,尝试在我的二进制文件中嵌入一个 29Mo 资源文件(假设它是一个视频文件)以供以后在运行时使用。
当我编译时,VS2015 报告:
fatal error C1060: compiler is out of heap space
有没有其他选择(使用 static const unsigned char 之外的东西)?使文件的行数减少但每行字符数增加? ...
注意:我尝试了/Zm1000 选项,但没有成功。
最佳答案
根据 MSDN documentation关于主题:
Eliminate unnecessary global variables, for example, by allocating memory dynamically instead of declaring a large array.
和
Split the current file into smaller files.
这两个问题你都应该修复。
关于c++ - 巨大的初始化列表,如何修复 "fatal error C1060: compiler is out of heap space",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51323518/