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
- 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 (http://search.microsoft.com) 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.
- 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.
- 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 CompilerThe combinations of compiler options in /O1, /O2, and /Ox are as follows:/O1: /Og /Os /Oy /Ob2 /Gs /Gf /GyIf 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.
/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.)
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 )
- 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.
- 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.
- 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.
- 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.
- Stop (or remove) any antivirus software that is running on the computer.
- If the preceding steps do not resolve the error, follow these steps:
- If the project is on a network share, determine whether the error recurs after you move the project to a local hard disk.
- 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.
- 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.
- 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.
- 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
- 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.
ID articol: 305980 - Ultima examinare: 27 iun. 2003 - Revizie: 1