Agreed, would need to know just how big the main compilation unit becomes when everything is #included. If the exe is only 32-bit, then it might be trying to allocate beyond the 2/4 GB range.
That happens when you try to compile a UTF-16 encoded file saved in Windows with gcc. Change encoding of your sources to UTF-8. See related CPP documentation.
What do you mean by this: "trying to allocate beyond the 2/4 GB range"? I have already tried
bcdedit /set IncreaseUserVa 3072
then I installed Visual Studio, and tried
editbin /LARGEADDRESSAWARE "<path>/cc1plus.exe"
which changes my old executable, but a new one is not compiling still.
I see you've done the research, good. Yes, I mean that if cc1plus.exe is a 32-bit process, it doesn't matter how much RAM you have total, because the address space of the process will still just either be 2 GB (if signed) or 4 GB (if unsigned).
Next thing to check would be the encoding of your file.
If you open the main file with Notepad, then click Save As... when does the Encoding show as in the save menu?
I cannot post it here, it is too big. But why would you want that? I am encountering a common problem. But I do not know what to do in order to compile.
> No, it is just one big source file. How to compile it?
...
> The main file is 1.055 kb.
There's an 8KB posting limit on this forum, so if your "big" source file is just over 1KB as you claim, then posting it isn't a problem.
Unfortunately I cannot post the main file. The size is 1,055 kB.
I have not yet tried everything, for example how to use bcdedit and
editbin during Eclipse compilation?
Are you maybe using huge arrays on the stack?
You can put your code on Dropbox, Google drive... and just show the link.
Without seeing the code we can just guess.
Well I have at least a 520 KB source file, albeit it's C# and not C++. It is uncommon, but it doesn't cause the compiler to crap out. I still think this is a MinGW bug (or, perhaps some template stuff is overloading the memory).
OP, if nothing else works I would download MinGW64 or another distro. Or use another compiler, clang or visual studio.
I've watched programming videos about auto-generated source code where compiling a single unit can take close to 30 minutes because of how huge the file is. But it doesn't fail the memory allocation. That's why I guess, despite the unusual circumstances, that this is an issue with the compiler.
But yes, having an MB file is insane, you should break it up into smaller units :)