CLI error during building

I wanted to continue working on my track while offline and also become used to the CLI but when ever I build I get an error which says:

Fatal error: can't write 233 bytes to section .text of CMakeFiles\freelancer-rates.dir\test\tests-main.cpp.obj: 'File too big'

I’d like to solve this issue and continue working from CLI henceforth.
The complete error log is stated here:

[main] Building folder: cpp 
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/PC/Exercism/cpp/build --config Debug --target all -j 6 --
[build] [ 33%] Building CXX object CMakeFiles/freelancer-rates.dir/test/tests-main.cpp.obj
[build] C:/PROGRA~1/CODEBL~1/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: CMakeFiles\freelancer-rates.dir\test\tests-main.cpp.obj: too many sections (32825)
[build] C:\Users\PC\AppData\Local\Temp\ccwEHlmS.s: Assembler messages:
[build] C:\Users\PC\AppData\Local\Temp\ccwEHlmS.s: Fatal error: can't write 233 bytes to section .text of CMakeFiles\freelancer-rates.dir\test\tests-main.cpp.obj: 'File too big'
[build] C:/PROGRA~1/CODEBL~1/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: CMakeFiles\freelancer-rates.dir\test\tests-main.cpp.obj: too many sections (32825)
[build] C:\Users\PC\AppData\Local\Temp\ccwEHlmS.s: Fatal error: can't close CMakeFiles\freelancer-rates.dir\test\tests-main.cpp.obj: File too big
[build] mingw32-make.exe[2]: *** [CMakeFiles\freelancer-rates.dir\build.make:89: CMakeFiles/freelancer-rates.dir/test/tests-main.cpp.obj] Error 1
[build] mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:84: CMakeFiles/freelancer-rates.dir/all] Error 2
[build] mingw32-make.exe: *** [Makefile:90: all] Error 2
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/PC/Exercism/cpp/build --config Debug --target all -j 6 -- exited with code: 2
[driver] Build completed: 00:00:21.872
[build] Build finished with exit code 2

1 Like

It might be helpful if you shared what command you ran and your code.

It shouldn’t be needed but there is also a -mbig-obj flag.

I didn’t reallly run any command. When the project is opened in Visual Studio Code, there is a build button which is used for that.
According to exercism guide for working with cli, it wasn’t necessary to bother running commands on windows with Visual Studio.