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 we have the simplest possible C++ "Hello, World" program, stored in main.cpp:
#include <stdio.h>
int main (int argc, char *argv[])
{
return 0;
}
When I run the command:
gcc main.cpp
I get the error message:
cc1plus: out of memory allocating 1677721600 bytes after a total of 475136 bytes
I verified I was compiling for the correct bittage (i.e., 32-bit). What was I doing wrong?