Microsoft KB Archive/843408

= BUG: You may receive a &quot;fatal error C1001: internal compiler error&quot; error message when you try to build an application in Visual C++ .NET 2003 =

Article ID: 843408

Article Last Modified on 4/3/2007

-

APPLIES TO


 * Microsoft Visual C++ .NET 2003 Standard Edition

-





SYMPTOMS
When you try to build an application in Microsoft Visual C++ .NET 2003, you may receive the following error message:

fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2701)

Please choose the Technical Support command on the Visual C++

Help menu, or open the Technical Support help file for more information

When you use the typedef statement to create an alias for a data type, and then you try to declare a class with the same alias name, a problem may occur. Instead of generating a meaningful error, the compiler incorrectly generates an internal compiler error when you try to build your Visual C++ .NET 2003 application.



CAUSE
Typically, you notice the error message that is mentioned in the &quot;Symptoms&quot; section in a Visual C++ .NET 2003 project when you declare the CString class, and then you try to build your project. In Microsoft Foundation Classes (MFC) 7.0, the CString class is rewritten based on the CStringT template class. CString is the name of an alias that is used with a typedef statement in the Afxstr.h header file that is included in your project by the Stdafx.h header file. Therefore, if you try to declare a class that is named CString, and then you try to build your project, you receive the error message that is mentioned in the &quot;Symptoms&quot; section.



WORKAROUND
In your Visual C++ .NET 2003 project, remove the declaration statement that you used to declare the class that has the same name as the alias that you created in the typedef statement.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Use the typedef statement to create an alias for a data type
 Start Visual Studio .NET 2003. On the File menu, point to New, and then click Project.

The New Project dialog box appears. Under Project Types, click Visual C++ Projects. Under Templates, click Console Application. In the Name box, type MyApp1 .</li> In the Location box, type C:\, and then click OK.

By default, a project that is named MyApp1 and a file that is named MyApp1.cpp are created.</li>  Locate the following code in the MyApp1.cpp file: using namespace System; </li>  Add the following code after the code that you located in the previous step: typedef int MyVar; class MyVar; </li> On the Build menu, click Build Solution.

You may receive the error message that is mentioned in the &quot;Symptoms&quot; section.</li></ol>

Declare the CString class
<ol> Start Visual Studio .NET 2003.</li> On the File menu, point to New, and then click Project.

The New Project dialog box appears.</li> Under Project Types, click Visual C++ Projects.</li> Under Templates, click Win32 Console Project.</li> In the Name box, type MyApp2 .</li> In the Location box, type C:\, and then click OK.

The Win32 Application Wizard - MyApp2 dialog box appears.</li> In the left pane, click Application Settings.</li> In the right pane, click Console Application under Application type.</li> In the Add support for section, click to select the MFC check box.</li> In the Additional options section, make sure that the Precompiled header check box is not selected, and then click Finish.

By default, a project that is named MyApp2 and a file that is named MyApp2.cpp are created.</li>  Locate the following code in the MyApp2.cpp file: using namespace std; </li>  Add the following code after the code that you located in the previous step: class CString; </li> <li>On the Build menu, click Build Solution.

You may receive the error message that is mentioned in the &quot;Symptoms&quot; section.</li></ol>

<div class="references_section">