【发布时间】:2014-12-21 09:51:29
【问题描述】:
在 Ubuntu 上使用“gcc”编译 C++ 源文件时遇到了一个令人费解的问题。解决了问题后,我想在这里发布它,以免其他人为解决它而头疼。
为了这份报告,我们有一个最简单的 C++“Hello, World”程序,存储在 main.cpp 中:
#include <stdio.h>
int main (int argc, char *argv[])
{
return 0;
}
当我运行命令时:
gcc main.cpp
我收到错误消息:
cc1plus: out of memory allocating 1677721600 bytes after a total of 475136 bytes
我确认我正在为正确的 bittage(即 32 位)进行编译。我做错了什么?
【问题讨论】: