Running 'gcc' on C++ source file on Linux gives "cc1plus: out of memory allocating ..." error message

Asked
Active3 hr before
Viewed126 times

4 Answers

error
90%

Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers ,Thanks for contributing an answer to Stack Overflow!, Meta Stack Overflow ,Stack Overflow en español

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;
}
load more v
88%

I had the same problem in compiling a C++ program with a MAKEFILE.,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.,The solution was to convert the source file back to a standard, non-Unicode encoding.,I found an easy way to get rid of this problem and it is delete the existing binary file from the previous compile.

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;
}
load more v
72%

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.,I set rpath to . so all libraries are linked using the relative file path,For the sake of this report we have the simplest possible C++ "Hello, World" program, stored in main.cpp:,Let's see where this error comes from in the php7 source tree:

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
load more v
65%

这个问题在这里已经有了答案: Running 'gcc' on C++ source file on Linux gives "cc1plus: out of memory allocating ..." error message (2 个回答) 5年前关闭。 我正在尝试移植我的 C++ library到 g++ 使用基本 makefile (它在 Visual Studio 中编译良好)。我现在尝试编译的部分大约有 45000 行代码。库本身编译正常,但是当我尝试将它包含到控制台接口(interface)应用程序中时,编译器崩溃并显示以下消息,仅此而已:,关于c++ - 如何在中等规模的项目中诊断 g++ 错误 "cc1plus.exe: out of memory allocating 838860800 bytes"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29194247/

这个问题在这里已经有了答案:





Running 'gcc' on C++ source file on Linux gives "cc1plus: out of memory allocating ..." error message

(2 个回答)


5年前关闭。




我正在尝试移植我的 C++ library到 g++ 使用基本 makefile (它在 Visual Studio 中编译良好)。我现在尝试编译的部分大约有 45000 行代码。

库本身编译正常,但是当我尝试将它包含到控制台接口(interface)应用程序中时,编译器崩溃并显示以下消息,仅此而已:

 cc1plus.exe: out of memory allocating 838860800 bytes

Other "error-undefined" queries related to "Running 'gcc' on C++ source file on Linux gives "cc1plus: out of memory allocating ..." error message"