fatal error C1001: An internal error has occurred in the compiler
Asked Answered
A

16

20

While compiling on x64 plattform I am getting following error:

c:\codavs05\hpsw-sc\ovpacc\tools\codaaccesstest\coda_access.cpp(1572): fatal error C1001: An internal error has occurred in the compiler.

(compiler file 'f:\dd\vctools\compiler\utc\src\p2\sizeopt.c', line 55)
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

------ Build started: Project: asyncexample, Configuration: Release Win32 ------

If I change settings to preprocessor file (Yes) i am not getting any error.

About my environment: Upgrading Microsoft Visual Studio 2005 to 2010

Please help.

Adrienneadrift answered 16/8, 2011 at 10:1 Comment(4)
possible duplicate of VC++ Internal Compiler ErrorPyrophosphate
Another compiler bug, but in a different place. Not an exact duplicate.Grevera
@Adrienneadrift - Perhaps we can see the code around line 1572?Grevera
if(t2.GetSecond() != sec || t2.GetMillisecond() != milli) here i am getting errorAdrienneadrift
M
13

I have had this problem with VS2015 while building locally in Windows.

In order to solve it, I deleted my build folder (Output Directory as seen in Properties/General) and rebuilt the project.

This always seems to help when strange things happen during the build.

Mannos answered 2/8, 2017 at 8:36 Comment(0)
I
9

I’ve encountered this error many times in VC++. Do the following steps. They’ve sometimes helped me with this issue:

  1. Take a look at the exact location, pointed out by compiler error.
  2. Find any external types or classes used there at that location.
  3. Change the order of “include path” of those files found in step 2 and rebuild the solution.
  4. I hope that help !!!!
Instantaneity answered 16/8, 2011 at 10:17 Comment(0)
L
9

I am getting same error with VC2012. Setting up the project properties Optimization to Disabled (/Od) resolved the issue.

Lindsley answered 3/2, 2014 at 12:27 Comment(2)
Doing this worked for me, but I think the problem may have been that the value was <different options>. Setting Optimizations to /Ox also worked.Grodin
The quick fix for me was to disable optimization around the function containing the problematic source line. So add #pragma optimize( "", off ) before the problematic function and #pragma optimize( "", on ) at the end of the function. See more: learn.microsoft.com/en-us/cpp/preprocessor/…Squatter
M
3

In my solution, i've removed output dll file of the project, and I've made project rebuild.

Majordomo answered 27/4, 2017 at 16:52 Comment(0)
M
2

I encountered the same error and spent quite a bit of time hunting for the problem. Finally I discovered that function that the error was pointing to had an infinite while loop. Fixed that and the error went away.

Mezoff answered 7/3, 2014 at 1:45 Comment(0)
G
2

In my case was the use of a static lambda function with a QStringList argument. If I commented the regions where the QStringList was used the file compiled, otherwise the compiler reported the C1001 error. Changing the lambda function to non-static solved the problem (obviously other options could have been to use a global function within an anonymous namespace or a static private method of the class).

Groundmass answered 30/1, 2017 at 10:57 Comment(0)
L
2

I got this error using boost library with VS2017. Cleaning the solution and rebuilding it, solved the problem.

Lindberg answered 27/2, 2018 at 16:6 Comment(0)
C
1

I also had this problem while upgrading from VS2008 to VS2010.

To fix, I have to install a VS2008 patch (KB976656).

Maybe there is a similar patch for VS2005 ?

Cleveite answered 9/1, 2013 at 16:33 Comment(0)
B
1

I got the same error, but with a different file referenced in the error message, on a VS 2015 / x64 / Win7 build. In my case the file was main.cpp. Fixing it for me was as easy as doing a rebuild all (and finding something else to do while the million plus lines of code got processed).

Update: it turns out the root cause is my hard drive is failing. After other symptoms prompted me to run chkdsk, I discovered that most of the bad sectors that were replaced were in .obj, .pdb, and other compiler-generated files.

Beacham answered 6/9, 2016 at 22:54 Comment(0)
F
1

I got this one with code during refactoring with a lack of care (and with templates, it case that was what made an ICE rather than a normal compile time error)

Simplified code:

void myFunction() {
    using std::is_same_v;
    for (auto i ...) {
       myOtherFunction(..., i);
    }
}

void myOtherFunction(..., size_t idx) {
    // no statement using std::is_same_v;
    if constexpr (is_same_v<T, char>) {
        ...
    }
}
Farmhouse answered 27/11, 2017 at 5:36 Comment(0)
S
0

I had this error when I was compiling to a x64 target. Changing to x86 let me compile the program.

Shashaban answered 17/10, 2017 at 14:38 Comment(0)
M
0

Sometimes helps reordering the code. I had once this error in Visual Studio 2013 and this was only solved by reordering the members of the class (I had an enum member, few strings members and some more enum members of the same enum class. It only compiled after I've put the enum members first).

Mohan answered 12/6, 2019 at 13:51 Comment(0)
T
0

In my case, this was causing the problem:

std::count_if(data.cbegin(), data.cend(), [](const auto& el) { return el.t == t; });

Changing auto to the explicit type fixed the problem.

Tolly answered 13/11, 2019 at 15:6 Comment(0)
A
0

Had similar problem with Visual Studio 2017 after switching to C++17:

boost/mpl/aux_/preprocessed/plain/full_lambda.hpp(203): fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'msc1.cpp', line 1518)
1> To work around this problem, try simplifying or changing the program near the locations listed above.

Solved by using Visual Studio 2019.

Antoneantonella answered 15/1, 2020 at 12:4 Comment(0)
F
0

I first encountered this problem when i was trying to allocate memory to a char* using new char['size']{'text'}, but removing the braces and the text between them solved my problem (just new char['size'];)

Fretwork answered 19/6, 2022 at 16:38 Comment(0)
P
0

Another fix on Windows 10 if you have WSL installed is to disable LxssManager service and reboot the PC.

Parlay answered 21/8, 2022 at 19:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.