PRB: C1001 Compiler Error Message - Suggestions for Troubleshooting


You may receive an error message similar to one of the following when you compile C or C++ source files:

C:\Projectcode\Test.cpp(20) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1089) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information.
fatal error C1001: INTERNAL COMPILER ERROR (compiler file '@(#)main.c:1.82', line 289) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information.
You may receive the error message during compilation of the first file during a build in the Visual Studio integrated development environment (IDE). It may always appear during compilation of a particular file or randomly during compilation of any file in the project. You may also receive the error message (irregularly) in a large project on a network drive. The error message may contain the name of a file from the project, with a line number in parentheses, or it may lack the file name. (Both variations are shown in the "Symptoms" section of this article.) Note that the compiler file name corresponds to the original source file of the compiler, which may be different for each C1001 error.


This behavior occurs if the compiler cannot generate correct code for a construct, most likely because the source file includes a combination of expressions that the compiler cannot easily recognize.

You can receive a "C1001" error message because of any of the following conditions:

  • A known bug in the compiler
  • A new bug in the compiler
  • A missing right brace (}) in a source file
  • A selected compiler optimization option
  • A file corruption issue
  • A hardware issue in the computer


To resolve this problem, follow these steps:

  1. If the error message contains the name of a file that is in your project, with a number in parentheses, the number represents the line number in that file in which the compiler detected an unknown error. (If the error message does not include a file name, proceed to step 3.)

    Compile this file from the Visual Studio IDE or from a command line. Use the CL /c Test.cpp command. (Note that before you run this command, you may have to run Vcvars32.bat to set the environment variables. This file is located in the Visual C++ installation directory\VC98\Bin folder.)

    If the error message occurs again, search the local online Help and Microsoft Developer Network ( for Microsoft Knowledge Base articles that include the keyword "C1001," the compiler file name (for example, "Msc1.cpp"), and the line number in the error message (for example, line "1089"). The search results may provide a description of the cause and a resolution.
  2. Check for a coding error in the particular line of the source file in which the error is reported. If the code is a complex expression, try rewriting the line in which the error is reported, or rewrite several lines of code that surround the problematic line. This may resolve the issue.
  3. The error may be caused by the use of optimization options to compile the file or the project. Before proceeding further in this section, try building your project for the Win32 Debug version. If Win32 Debug build produces the "C1001" error message, proceed to step 5.

    You can probably fix the issue by removing one, several, or all optimization options.

    When you select Win32 Release build in the Visual Studio 6.0 IDE, you may select /O1 (Minimize Size), /O2 (Maximize Speed), /Ox (Full Optimization), or Customize under C or C++ Project Settings. Under Customize, you may select other options of your choice. To determine which option is at fault, clear the selection of options one at a time, and then recompile until the error stops occurring. The options most commonly responsible are /Og, /Oi, /Ob1, and /Oa.

    If you are using the Visual Studio .NET IDE, see the following Knowledge Base article for information about how to change the compiler options:
    311065 HOW TO: Modify Default Compiler Options for the Visual C++ .NET Compiler
    The combinations of compiler options in /O1, /O2, and /Ox are as follows:
    /O1: /Og /Os /Oy /Ob2 /Gs /Gf /Gy
    /O2: /Og /Oi /Ot /Oy /Ob2 /Gs /Gf /Gy
    /Ox: /Og /Oi /Ot /Oy /Ob2 /Gs

    (NOTE: In Visual C++ 6.0 and 5.0, /Ob1 is used in place of /Ob2.)
    If you are compiling from a command line, use the minus sign (-), as in /O2 /Oi-, to eliminate one or more options. This removes the /Oi option from /O2. Or, you can start with only one option and then add other options one at a time to determine which option or combination of options causes the C1001 error.

    After you have determined which optimization option is causing the error, you can programmatically disable that option. To disable an option, use the optimize pragma off argument around the function in which the error occurs, and then enable the option for the rest of the module, as shown in the following sample code (which disables the /Og option). To disable and enable all options, use #pragma optimize( "", off ) and #pragma optimize( "", on ), respectively.

    #pragma optimize( "g", off )
    // Function definition
    #pragma optimize( "g", on )
  4. Make sure that the number of lines in the source file in which the error is reported is less than the compiler limit of 65,536. If the number is not less than the limit, comment out some lines in the file, and then determine whether the error recurs.
  5. If you are using a portable computer in a docking station, remove it from the docking station, restart the computer, and then determine whether the error stops occurring. Some portable models may display this behavior.
  6. Make sure that there is enough disk space available on the hard disk. The recommended minimum is 500 megabytes (MB). Also, make sure that the maximum virtual memory paging file size is set to 500 MB or more.
  7. Restart the computer in safe mode, and then determine whether the error recurs. If it does not, this indicates a bad driver in your computer. The most likely culprit is a video driver. Consult the driver manufacturer for a new driver.
  8. Stop (or remove) any antivirus software that is running on the computer.
  9. If the preceding steps do not resolve the error, follow these steps:
    1. If the project is on a network share, determine whether the error recurs after you move the project to a local hard disk.
    2. The error may occur only for a specific project (especially if the project is very large). If this is the case, determine whether the error occurs on another computer. If it does, the issue may be caused by a limitation in the compiler, which you can check by reducing the number of files in the project or the size of large files. If the error does not occur on another computer, there may be a hardware issue in the computer on which the error is reported.
    3. Create a simple one-line C or C++ program that prints "Hello world." Try to compile this file from the Visual Studio IDE, or from the command line.
    4. Try to build a default AppWizard-created Microsoft Foundation Classes (MFC) project.

      NOTE: Failure in steps c or d means that there is an installation issue related to software or hardware. In most cases, this turns out to be hardware-related, such as a bad device driver (see step 7), a bad RAM module, or a bad hard disk.
    5. Remove and then reinstall the program. If you are using Visual Studio .NET, read the instructions in the Readme.htm file about how to remove the program. If you are using Visual C++ 6.0, see the following Microsoft Knowledge Base article:
      248347 HOWTO: Prepare for and Perform a Clean Installation of Visual Studio 6.0
    6. It is also possible that your product CD-ROMs are corrupted. If possible, attempt the installation with a different set of CD-ROMs. Also, before you blame a bad hard disk or bad RAM module for the issue, format the hard disk, reinstall the operating system, and then reinstall the program.
If no article is found in step 1 that provides a solution, or if the error is resolved in steps 2 or 3, the issue may represent a new bug. Please report the issue to Microsoft Product Support Services at the following Microsoft Web site:


For other top-hit Visual C++ .NET Microsoft Knowledge Base articles, visit the following Microsoft Web site:

ID articol: 305980 - Ultima examinare: 27 iun. 2003 - Revizie: 1