1

I am trying to build a project (SUBSYSTEM:WINDOWS) and my main looks like that:

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) {/*Code here*/}

I get following error in VisualStudio Community 2015 v. 14.0.25431.01 when building the release version:

1>e:\github\g19systemmonitor\g19tastatur applet\main.cpp : fatal error C1001: Interner Compilerfehler.
1>  (Compilerdatei "f:\dd\vctools\compiler\utc\src\p2\main.c", Zeile 255)
1>   Vereinfachen oder ändern Sie das Programm im Umfeld der oben aufgeführten Positionen. Wählen
1>  Sie im Menü "Hilfe" von Visual C++ den Befehl "Technischer Support",
1>  oder öffnen Sie die Hilfedatei des technischen Supports, um weitere Informationen zu erhalten.
1>    link!InvokeCompilerPass()+0x24399
1>    link!InvokeCompilerPass()+0x24399
1>    link!InvokeCompilerPass()+0x1dda7
1>    link!InvokeCompilerPass()+0x1dc8b
1>    link!InvokeCompilerPass()+0x298f7
1>    link!InvokeCompilerPass()+0x214ba
1>    link!DllGetC2Telemetry()+0xe39f7
1>
1>e:\github\g19systemmonitor\g19tastatur applet\main.cpp : fatal error C1001: Interner Compilerfehler.
1>  (Compilerdatei "f:\dd\vctools\compiler\utc\src\p2\main.c", Zeile 255)
1>   Vereinfachen oder ändern Sie das Programm im Umfeld der oben aufgeführten Positionen. Wählen
1>  Sie im Menü "Hilfe" von Visual C++ den Befehl "Technischer Support",
1>  oder öffnen Sie die Hilfedatei des technischen Supports, um weitere Informationen zu erhalten.
1>    link!InvokeCompilerPass()+0x24399
1>    link!InvokeCompilerPass()+0x1dda7
1>    link!InvokeCompilerPass()+0x1dc8b
1>    link!InvokeCompilerPass()+0x298f7
1>    link!InvokeCompilerPass()+0x214ba
1>    link!DllGetC2Telemetry()+0xe39f7
1>
1>
1>LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage
1>
1>    Version 14.00.24215.1
1>
1>    ExceptionCode            = C0000005
1>    ExceptionFlags           = 00000000
1>    ExceptionAddress         = 502E892F (4FF40000) "D:\Programme\Visual Studio 2015\VC\bin\c2.dll"
1>    NumberParameters         = 00000002
1>    ExceptionInformation[ 0] = 00000000
1>    ExceptionInformation[ 1] = 00000036
1>
1>  CONTEXT:
1>    Eax    = 00000000  Esp    = 012FE5C0
1>    Ebx    = 00000000  Ebp    = 012FE5D4
1>    Ecx    = 05650210  Esi    = 00000024
1>    Edx    = 00000000  Edi    = 05650210
1>    Eip    = 502E892F  EFlags = 00010246
1>    SegCs  = 00000023  SegDs  = 0000002B
1>    SegSs  = 0000002B  SegEs  = 0000002B
1>    SegFs  = 00000053  SegGs  = 0000002B
1>    Dr0    = 00000000  Dr3    = 00000000
1>    Dr1    = 00000000  Dr6    = 00000000
1>    Dr2    = 00000000  Dr7    = 00000000

A few weeks ago, I was able to build a release version of the project with the same compiler settings and the same code as I use now perfectly. I have tryed to remove the optimizations as recomended in the MSDN which did not work.

But I have noticed something strange:

When I delete any of the 3 files (.exe .iobj .ipdb) in the Release folder and rebuild the solution, it works just fine (new versions of the 3 files are getting created). When I change any setting in the project or when I add only a single line of code and try to rebuild, the same error occurs. If I then delete one of those 3 files again, I can build once more.

I think that this behavior could be caused by some compiler setting I don't know but I am not sure as I am not a VisualStudio expert.

Peter Winzer
  • 165
  • 7

3 Answers3

1

This happened to me, and I fixed it by going to my Release folder and deleting all the *.ipdb files. I noticed on the project that did link successfully that Visual Studio sometimes said:

All 5226 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.

..and then when I checked the dates on the *.ipdb files for the project that was failing to link, I noticed the file date was still from yesterday evening. Once I deleted all the *.ipdb files in the Release folder, it forced Visual Studio 2015 to recreate them on the next build, and then my project built successfully!

dbeachy1
  • 179
  • 1
  • 3
  • 12
0

O.k. I solved the problem by creating a new project and adding all the .cpp & .h files from the old project to it.

I still think there was a problem with the project settings which I set to default by creating a new project.

Peter Winzer
  • 165
  • 7
0

In Visual Studio 2017 you need to switch the Project->Properties->C/C++->Optimization->Whole Program Optimization to No instead of Yes.

maxpayne
  • 1,111
  • 2
  • 21
  • 41
  • Maybe in your specific case. Internal Compiler Errors are usually dependent on the code that the compiler is compiling. – drescherjm Dec 29 '17 at 13:23