2
votes

I have just upgraded Microsoft Visual Studio Enterprise 2015 from Update 2 to Update 3 and now I am getting the following error:

fatal error C1001: An internal error has occurred in the compiler. (compiler file 'f:\dd\vctools\compiler\utc\src\p2\wvm\mdmiscw.c', line 2687) 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

The location is the first line which includes a header. The project has settings

/FR"x64\Debug\" /GS /W3 /Zc:wchar_t /Zi /Od /Fd"x64\Debug\vc140.pdb" /Zc:inline /fp:precise /D "WIN32" /D "_DEBUG" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /clr [some /FU"..."] /MDd /Fa"x64\Debug\" /EHa /nologo /Fo"x64\Debug\" /Fp"....pch"

How do I make my project build again?

2
"To work around this problem, try simplifying or changing the program".Hans Passant
@MciprianM: any update on the issue? I got the same compiling error with clr and vs2015. Unfortunately the message didn't tell me which line of my code caused the error. :(Louis
@Louis: We have not found the reason of the error, so we reinstalled everything up to update 2. I have heard of others who had the same issue in different companies. As a side note, you should be careful when you install anything in visual studio, it might have update 3 as a dependency and you might update to update 3 by mistake.MciprianM
@MciprianM: Thanks for updating. Actually during the last a couple of weeks, I have tried vs2017. The error is magically gone. My project is in working shape now. However, there are some new headaches to deal with in vs2017.Louis

2 Answers

6
votes

C1001 basically indicates a compiler crash, i.e. you might have created valid C/C++ code that triggers a bug in the VC compiler. It would probably be a good idea to submit a bug report via https://connect.microsoft.com/VisualStudio/Feedback for further investigation by Microsoft.

I myself just ran into a C1001 while compiling OpenCV with Visual Studio Express 2015 Update 3. In my case, the C1001 error message also pointed me to the OpenCV core code line that triggers the compiler crash. After looking into the actual code semantics at that particular line, I suspected the compiler's floating point handling to be the root cause of the issue. It was dealing with a big, hard-coded double array lookup table which might have caused rounding issues. (Just in case somebody googles for this, I am listing the reference here: opencv_core, mathfuncs_core.cpp, line 1261, macro-expansion of LOGTAB_TRANSLATE).

In my case, setting the compiler's floating-point model from 'precise' to 'strict' resolved the C1001 issue. However, as you haven't included a code fragment of the lines that cause the C1001 to raise, it's difficult to say whether the above will fix your issue as well. If you want to give it a try, you can find the compiler switch in your project settings / C/C++ / Code Generation tab. Instead of Precise (/fp:precise), select Strict (/fp:strict) as Floating Point Model. This change may affect the performance of your code, but should not affect its precision. See https://msdn.microsoft.com/en-us/library/e7s85ffb.aspx for further information.

4
votes

According to visual studio developers community, this issue was fixed and closed (on July 2019) and should not appear at latest VS version. So upgrading to the latest version should solve the issue.

However, I've just now upgraded my VS to the latest version (16.7.1) and I still encounter this problem getting fatal error C1001: Internal compiler error.

Finally the following solution worked for me: change the optimization option (project properties->C/C++->optimization) to 'Custom' and at (project properties->C/C++->command line') add additional options of '/Ob2, /Oi, /Os, /Oy'.

taken from: Visual studio in stuck Generating code