Why does Microsoft Visual Studio throw an error about "exceeded object file format limit" when I try to compile a model?

13 vues (au cours des 30 derniers jours)
I have a very large model and when I try to generate code and compile model, I get an error from Microsoft Visual Studio as below:
ERROR: error C1128: number of sections exceeded object file format limit : compile with /bigobj NMAKE : fatal error U1077: '"c:\program files\microsoft visual studio 9.0\VC\BIN\cl.EXE"' : return code '0x1' Stop. 

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 17 Jan 2025
Modifié(e) : MathWorks Support Team le 31 Jan 2025
This error is thrown if the object file is too large for Visual Studio to handle.
As a workaround, pass the "/bigobj" flag to the compiler in the makefile for the target. Please follow the below link to find more information on the Fatal error: 
There are two main ways of achieving this:
 
  1. If the model is using "ert_vc.tmf", then make a copy of this file and change the compiler options. Save the modified file with a different name on the MATLAB path and use it in the "Template makefile" option in the Code Generation pane of the model Configuration Parameters. For more information on template makefiles see the following page of the documentation:
  2. Create a custom '<STF>_make_rtw_hook' file, such that the flag "/bigobj" is automatically added to the compilation process during the "before_make", by following the documentation below and refer to the attached M-file:
Instead of modifying template makefiles or build hooks, you may find it easier to insert compiler directives in the model's configuration parameters. To find more information on custom compiler optimization flags in MATLAB R2020a, execute the following command in the command window to view the release-specific documentation:
>> web(fullfile(docroot, 'rtw/ref/custom-compiler-optimization-flags.html'))
NOTE: Please do not modify any shipped file. If you need to customize it, always make a copy and then use the copy so that other models using the shipped file are not affected.
A long-term solution for this issue would be to use Model Referencing in order to divide the model into smaller parts. As a result, smaller files are generated during the code generation process and resource requirements during compile time are reduced.
For details on Model Referencing see:
Please follow the below link to search for the required information regarding the lastest release:

Plus de réponses (0)

Catégories

En savoir plus sur Simulink Coder dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by