在Linux上的C ++源文件上运行'gcc'会导致“cc1plus:内存不足......”错误消息(Running 'gcc' on C++ source file on Linux gives “cc1plus: out of memory allocating …” error message)
在Ubuntu上编译使用'gcc'的C ++源文件时遇到了一个令人费解的问题。 解决了这个问题之后,我想在这里发布它,以帮助其他人解决问题。
为了这个报告,我们有最简单的C ++“Hello,World”程序,存储在main.cpp中:
#include
int main (int argc, char *argv[])
{
return 0;
}
当我运行命令时:
gcc main.cpp
我收到错误消息:
cc1plus: out of memory allocating 1677721600 bytes after a total of 475136 bytes
我证实我正在编译正确的比特(即32位)。 我做错了什么?
I encountered a puzzling problem when compiling a C++ source file using 'gcc' on Ubuntu. Having solved the problem I would like to publish it here to save others the headache of solving it.
For the sake of this report w