Reputation: 513
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?
Upvotes: 2
Views: 7370
Reputation: 1401
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.
An edit: See the comments below, people say the issue also appears at VS 2022 17.3.6 and at VS 2019 16.9.4
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
Upvotes: 4
Reputation: 161
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.
Upvotes: 6