Why do I get "fatal error C1001: An internal error has occurred in the compiler" when using Microsoft Visual Studio C/C++ compiler?

31 views (last 30 days)
When building my Simulink model using Microsoft Visual Studio 2017 C/C++ compiler, I get the following internal compiler error in the build log:
...\tunnelmodell_slrt_rtw\tunnelmodell.c(17912) : fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 256)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
cl!CloseTypeServerPDB()+0x757c1
cl!DllGetC2Telemetry()+0xe3ae8
cl!CloseTypeServerPDB()+0x7b1fc
cl!CloseTypeServerPDB()+0x73e8e

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 3 Nov 2020
Edited: MathWorks Support Team on 3 Nov 2020
The error message indicates that this is a bug in Microsoft Visual Studio 2017 C/C++ compiler. One common cause are compiler optimizations applied to the code. See if setting the Code Generation > Compiler optimization level to Optimizations off (faster builds) in the model configuration parameters eliminates the error.
If this does not help, try to install the most recent version of Visual Studio 2017 C/C++ compiler, or use a different supported compiler (e.g. MinGW or other versions of Microsoft Visual Studio). To select the C/C++ compiler used by MATLAB, use the commands:
>> mex -setup c % set C compiler
>> mex -setup cpp % set C++ compiler
We encourage you to report the bug to Microsoft. To do this, open an account with the Visual Studio Developer Community and select "Report a problem". Attach full reproduction code to the report, so that Microsoft will be able to debug and fix the issue. Use the "Package code and artifacts" in our model parameters to get a ZIP archive of all source files, add the batch and make-files (model.bat, model.mk) and possible other dependencies (rtw_proj.tmw, model_comp.rsp) that may be required to run the model.bat file outside of the MATLAB environment.

More Answers (0)

Categories

Find more on Troubleshooting in MATLAB Compiler SDK in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!