BUG: You may receive a "fatal error C1001: internal compiler error" error message when you try to build an application in Visual C++ .NET 2003 (843408)



The information in this article applies to:

  • Microsoft Visual C++ .NET (2003)

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 "Symptoms" 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 "Symptoms" 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 "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

Use the typedef statement to create an alias for a data type

  1. Start Visual Studio .NET 2003.
  2. On the File menu, point to New, and then click Project.

    The New Project dialog box appears.
  3. Under Project Types, click Visual C++ Projects.
  4. Under Templates, click Console Application.
  5. In the Name box, type MyApp1.
  6. 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.
  7. Locate the following code in the MyApp1.cpp file:
    using namespace System;
    
  8. Add the following code after the code that you located in the previous step:
    typedef int MyVar;
    class MyVar;
  9. On the Build menu, click Build Solution.

    You may receive the error message that is mentioned in the "Symptoms" section.

Declare the CString class

  1. Start Visual Studio .NET 2003.
  2. On the File menu, point to New, and then click Project.

    The New Project dialog box appears.
  3. Under Project Types, click Visual C++ Projects.
  4. Under Templates, click Win32 Console Project.
  5. In the Name box, type MyApp2.
  6. In the Location box, type C:\, and then click OK.

    The Win32 Application Wizard - MyApp2 dialog box appears.
  7. In the left pane, click Application Settings.
  8. In the right pane, click Console Application under Application type.
  9. In the Add support for section, click to select the MFC check box.
  10. 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.
  11. Locate the following code in the MyApp2.cpp file:
    using namespace std;
  12. Add the following code after the code that you located in the previous step:
    class CString;
  13. On the Build menu, click Build Solution.

    You may receive the error message that is mentioned in the "Symptoms" section.

REFERENCES

For additional information, visit the following Microsoft Developer Network (MSDN) Web sites:

CStringT classShared classesBreaking changes in ATL 7.0 and MFC 7.0 since Visual C++ 6.0

Modification Type:MinorLast Reviewed:1/18/2006
Keywords:kbtemplate kbCompiler kberrmsg kbbug KB843408 kbAudDeveloper