gpt4 book ai didi

c++ - 在 Visual C++ 2015 中使用 64 位编译器

转载 作者:可可西里 更新时间:2023-11-01 17:58:18 25 4
gpt4 key购买 nike

我有一个包含大量模板的 C++ 项目,它无法编译并显示 fatal error C1060: compiler is out of heap space。有足够的可用内存。我尝试使用/Zm 编译器选项进行支付,但没有用。我可以看到 Visual Studio 使用 32 位版本的编译器,我认为这就是这个错误的原因。有什么方法可以强制 Visual Studio 使用 64 位编译器吗?

更新

我的问题不是重复的。我看到了其他问题并尝试了这些建议。但在我的例子中,编译器需要超过 6 GB 的 RAM 来编译项目。这是 64 位编译器分配的最大 RAM 量。在使用 msbuild 构建我的项目时,我可以使用 64 位编译器,但我想从 Visual Studio 构建它,它默认使用 32 位编译器。我想强制它使用 64 位编译器。我所说的 64 位编译器是指编译器不仅可以创建 64 位应用程序,而且它本身也是 64 位应用程序。

最佳答案

引用https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx?f=255&mspperror=-2147217396#Anchor_1 , compiler which is x64 64-bit native 可以使用。

这样做,如 https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx#Anchor_0 中所述,在命令提示符下运行 vcvarsall amd64

然后,当在命令行上运行 devenv 时,添加 /useenv 选项:

If you are using DEVENV for command-line builds, the environment set by vcvarsall.bat or vcvars32.bat does not affect your builds, unless you also specify the /useenv option.

关于c++ - 在 Visual C++ 2015 中使用 64 位编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36846509/

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