Вопрос

Similar question with no real answer applicable to my case : CLICK
Question which I researched before asking here - CLICK

I'm using MinGW64 to try and compile a very large .cpp file (>13k lines), but I also have access to Visual Studio 2010 - if someone has a solution using that, feel free to tell me.
I've identified an error in the assembling stage -

... too many sections (33396)
C:\Users\username\AppData\Local\Temp\ccnAocvD.s: Assembler messages:
C:\Users\username\AppData\Local\Temp\ccnAocvD.s: Fatal error: can't write 
CMakeFiles/source.dir/sourcecode.cpp.obj: File too big

I'm currently running the compilation with the -Os , --param ggc-min-expand=0, --param ggc-min-heapsize=4096 as suggested by two of my colleagues - the compilation is running way over 5 hours now.

Update:

As suggested by some people, I will just split the file into 2 source files and create a header for them - thanks.

Second Update:

Compilation hasn't finished yet(5 days !!!), even after creating a header and splitting the file into 4 smaller ones.

Final

This problem remained unresolved - even after following advice from everyone that posted I still couldn't manage to compile this.

Это было полезно?

Решение

Not sure about GCC, but have you tried the /bigobj flag for that specific file in VisualStudio?
I had the same issue with a large file, and it actually solved the issue. So it's worth a try.

From MSDN:

By default, an object file can hold up to 65,536 (2^16) addressable sections. This is the case no matter which target platform is specified. /bigobj increases that address capacity to 4,294,967,296 (2^32).

More about this here.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top