巨大的初始化列表,如何解决“严重错误C1060:编译器空间不足". [英] Huge initialization list, how to fix "fatal error C1060: compiler is out of heap space"

查看:116
本文介绍了巨大的初始化列表,如何解决“严重错误C1060:编译器空间不足".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译一个简单的C ++文件,该文件可以:

I'm trying to compile a simple C++ file that does:

static const unsigned char content[] = 
        {
              // 29MB of data written as "0x1E, 0x83, 0x3E, 0x86, 0xC8, 0x80, ...". 10 values per line
        };

要编译的文件几乎有3M行,约为200Mo

The file to compile has almost 3M lines and is ~200Mo

这是资源管理系统的输出,试图将29Mo的资源文件(假设它是视频文件)嵌入到我的二进制文件中,以便以后在运行时使用.

This is an output from a ressources management system, trying to embed in my binary a 29Mo ressource file (let's assume it's a video file) for later use at runtime.

我编译时,VS2015报告:

When I compile, VS2015 reports:

严重错误C1060:编译器空间不足

fatal error C1060: compiler is out of heap space

是否有其他选择(使用除静态const unsigned char之外的其他方法)?使文件的行数更少,但每行字符更多?...

Is there any alternative to that (use something else than a static const unsigned char)? Make the file have less lines but more characters per line? ...

注意:我尝试了/Zm1000选项,但没有成功.

Note: I tried /Zm1000 option without success.

推荐答案

按照

例如通过分配来消除不必要的全局变量动态内存,而不是声明一个大数组.

Eliminate unnecessary global variables, for example, by allocating memory dynamically instead of declaring a large array.

将当前文件拆分为较小的文件.

Split the current file into smaller files.

这两个都应该修复.

这篇关于巨大的初始化列表,如何解决“严重错误C1060:编译器空间不足".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆