A coder's home for Marc "Foddex" Oude Kotte, who used to be located in Enschede, The Netherlands, but now in Stockholm, Sweden!

Microsoft Visual Studio .NET 2003 - Internal Compiler Errors (ICE!) [upd. Nov 2012]

Originally posted at Sat 20-05-2006 13:57:55, last modified at Wed 14-11-2012 00:41:23, in the c++ category.

While being pretty much anti everything Microsoft does or releases, I'm usually a big fan of their C++ compiler. I don't really care about the often heared argument from the open source world that VC++ doesn't support any C/C++ standard properly. It supports the standards I require good enough, and any portability issues it may cause are more often than not solved in a few hours (in my experience, that is ;-)).

However, there's one aspect of the VC++ compiler that I absolutely despise. Everything is going according to plan, when all of a sudden you get the following dreaded error message:

yourfile.cpp(17) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'f:\\vs70builds\\3077\\vc\\Compiler\\Utc\\src\\P2\\<SOMEFILE>',
line <SOME LINE>)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information

Getting this message means you're in Microsoft's hell. Welcome to the world where problems are solved in an entirely different manner. Googling for the terms "INTERNAL COMPILER ERROR C1001" and then the "<SOMEFILE>" and "<SOME LINE>" terms yields results showing other poor suckers who had the same problem, and most of the time (read: in every case) never got any solutions. You can mail Microsoft for 'support', but it won't get you anywhere. It seems they are willing to acknowledge it's a (known) problem, but are totally unwilling to fix it. (How different is the gcc team in this, read for yourself.)

During my time at Khaeon Games B.V. I've encountered internal compiler errors many times, and actually in every case I was able to fix the problem. What follows are some example cases with internal compiler error messages I had, and the solutions I found to solve them.

There are two tips I can give in advance though, when you get an internal compiler error in VC++...

  • ...turn off Precompiled Header support for the file/project you have ICE issues with.
  • ...try cleaning your entire solution.
Still no luck? Then read on!

p2symtab.c, line number 4533 (20-05-2006)

I got this error on a piece of code looking like this:

	if (SomeExpression) {
		SomeObj->SomeFunc( "PlayerWalking" );
Changing "PlayerWalking" into "PlayerWalkin" or "PlayerWalking2" stopped the ICE from happening, however, that was not the string I needed! Creating a const char* variable containing that particular string and supplying that to the SomeFunc function didn't solve the problem, as the ICE would occur on the line where I assigned the variable. This let to the clue that the compiler for some reason seriously disliked the string "PlayerWalking". So I started searching all header files (it were a LOT, actually) and found that in one particular (huge) header file, I had defined a class, and in it I had implemeted a function:
	class SomeClass {
		function SomeFunc() {
			static SomeClass SomeObject( "PlayerWalking" );
AHA! I moved the implementation of the function away from the header file and into a source file, and the ICE was gone. Did it make sense? No. Did it work? Yes! It's just the way of the Microsoft I guess.

msc1.cpp, line number 1411 (13-07-2011)

This one was the weirdest ICE I've ever seen to date. I had a small project that compiled just fine, until at one point it would give me the following error:

fatal error C1001: An internal error has occurred in the compiler. msc1.cpp 1411
Code that compiled before, didn't any longer. So, using Subversion, I reverted the code to yesterday's state when everything was still fine: same error... eh, come again?

So the solution this time? First I thought, let's clear the solution. No luck. Restart MSVC++, no luck. Eventually, the solution was: restart my PC. Yes, the millenia old solution (I think it was emperor Nero in 63 BC who first thought of this) worked. This was the first time I ever saw this working for an ICE!

UPDATE 14-11-2012
I also ran into this specific internal compiler error trying to compile a boost bind call. I wanted a function to be called taking one variable parameter. My function was:
  class client_login_window {

     void handle_keydown( key_type type );
My bind call was incorrect, completely screwing with the compiler:
  mUsername->add_on_key_down( bind( &client_login_window::handle_keydown, this ) );
This ofcourse had to be the following, and after correcting the code, the ICE went away:
  mUsername->add_on_key_down( bind( &client_login_window::handle_keydown, this, _1 ) );

-- Foddex

0 comment(s)

URL: (optional!)
Write your comment:
Answer this question to prove you're human:
What's the last name of the first black American president?