在Ubuntu上使用'gcc'编译C++源文件时遇到了一个令人费解的问题.解决了这个问题后,我想在这里发布它,以免其他人解决问题.
为了这个报告,我们有最简单的C++"Hello,World"程序,存储在main.cpp中:
#include <stdio.h>
int main (int argc, char *argv[])
{
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我运行命令时:
gcc main.cpp
Run Code Online (Sandbox Code Playgroud)
我收到错误消息:
cc1plus: out of memory allocating 1677721600 bytes after a total of 475136 bytes
Run Code Online (Sandbox Code Playgroud)
我确认我正在编译正确的位数(即32位).我做错了什么?