When template classes or template class header files are included in a precompiled header file, the compiler may generate the following error for files that use the precompiled header: fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) -or- fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1188)
This error occurs only on machines with the Windows 95 or Windows 98 operating system. CAUSE The compiler exceeds the allocated memory limit. RESOLUTION Use one of the following three suggested workarounds: Use compiler switch /Zm#nn to increase the compiler's heap memory allocation limit. The default value of #nn is 100 and the maximum value is 2000. Manually add this switch in Developer Studio: under the Project menu, click Setting, the click C/C++, then Project Options. Usually, a value of 1000 works. NOTE: You may need to increase the system virtual memory to accommodate the increased #nn for /Zm. -or-
Remove the template class header files from the precompiled header file. -or-
Use "Automatic use of precompiled headers" (/YX switch), or, "Not using precompiled header."
请看帮助。 SYMPTOMS Using /O1 (minimize size) or /O2 (maximize speed) causes a C1001 error in a try block with the following error message: fatal error C1001: INTERNAL COMPILER ERROR (compiler file '\school.tp3\test\c10\src\P2\main.c', line 413) Additionally, C++ exception handling must be enabled (/GX). If the warning level is set to 4 (/W4), C4702 (unreachable code) warnings are issued before the C1001 fatal error. CAUSE The cause of the problem is having both /Og (global optimizations) and inline function expansion /Ob1 (Only __inline) or /Ob2 (Any Suitable) compiling. /O1 and /O2 are both compound switches, including /Og and /Ob1. RESOLUTION Disable either global optimizations (/Og-) or inline function expansion (/Ob1- or /Ob2-). Please see the More Information section below. STATUS Microsoft has confirmed this to be bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 32-bit Edition version 4.2. MORE INFORMATION The following code reproduces the error when compiled: // Compile option needed are: /GX, /W4, and /O1(minimize size) // or /O2 (maximize speed) struct A { ~A(){} }; struct B { A a; }; void main(void) { try // line 17 { B *pB = new B[4]; delete [] pB; // line 20, warning C4702: unreachable code } catch(...) { } } The following error message is generated: test.cpp(17) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file '\school.tp3\test\c10\src\P2\main.c', line 413) Compiling from command line with both /Og (global optimizations) and in-line function expansion, /Ob1(Only __inline) or /Ob2 (Any Suitable), reproduces the error. For instance, using: cl /Og /Ob1 /GX /W4 test.cpp Compiling with the following switch settings in command line does not produce errors: cl /Og /GX /W4 test.cpp - or - cl /Ob1 /GX /W4 test.cpp One workaround when using /O1 or /O2 in Developer Studio is to disable In-line function expansion (Build:Settings, C++ Tab, Optimizations category). Another workaround is to disable global optimizations. To accomplish this, choose Custom for the type of optimization (Build:Settings, C++ Tab, Optimizations category). Check all categories that apply, but do not check global optimizations. This behavior is similar to using the components of /O1 or /O2 and eliminating /Og). An additional method is to leave /O1 or /O2 intact and manually add /Og- to the Project Options.
你的编译设定被改了。在"project\setting"的"c\c++"里点击"RESET"试试。
微软肯定这是一个BUG,但这个BUG在VC的32位系统里已被改正。你装的什么操作系统?
我装的是Windows 2000 Server, 该怎么解决?
看这一段。在"project\setting"的"c\c++"的"project options"里改。 RESOLUTION Disable either global optimizations (/Og-) or inline function expansion (/Ob1- or /Ob2-). Please see the More Information section below.
1.Reboot VC 2.Use All compile
To dhc_lmy 可以,但是每次都要这样,不是很麻烦。To:kunjun_oy 好象没有/Og/Ob1/Ob2出现
(compiler file 'msc1.cpp', line 1786) -or- fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1188)
This error occurs only on machines with the Windows 95 or Windows 98 operating system. CAUSE
The compiler exceeds the allocated memory limit. RESOLUTION
Use one of the following three suggested workarounds: Use compiler switch /Zm#nn to increase the compiler's heap memory allocation limit. The default value of #nn is 100 and the maximum value is 2000. Manually add this switch in Developer Studio: under the Project menu, click Setting, the click C/C++, then Project Options. Usually, a value of 1000 works.
NOTE: You may need to increase the system virtual memory to accommodate the increased #nn for /Zm. -or-
Remove the template class header files from the precompiled header file.
-or-
Use "Automatic use of precompiled headers" (/YX switch), or, "Not using precompiled header."
SYMPTOMS
Using /O1 (minimize size) or /O2 (maximize speed) causes a C1001 error in a try block with the following error message:
fatal error C1001: INTERNAL COMPILER ERROR
(compiler file '\school.tp3\test\c10\src\P2\main.c', line 413)
Additionally, C++ exception handling must be enabled (/GX). If the warning level is set to 4 (/W4), C4702 (unreachable code) warnings are issued before the C1001 fatal error. CAUSE
The cause of the problem is having both /Og (global optimizations) and inline function expansion /Ob1 (Only __inline) or /Ob2 (Any Suitable) compiling. /O1 and /O2 are both compound switches, including /Og and /Ob1. RESOLUTION
Disable either global optimizations (/Og-) or inline function expansion (/Ob1- or /Ob2-). Please see the More Information section below. STATUS
Microsoft has confirmed this to be bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 32-bit Edition version 4.2. MORE INFORMATION
The following code reproduces the error when compiled:
// Compile option needed are: /GX, /W4, and /O1(minimize size)
// or /O2 (maximize speed)
struct A
{
~A(){}
};
struct B
{
A a;
};
void main(void)
{
try // line 17
{
B *pB = new B[4];
delete [] pB; // line 20, warning C4702: unreachable code
}
catch(...)
{
}
}
The following error message is generated: test.cpp(17) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file '\school.tp3\test\c10\src\P2\main.c', line 413)
Compiling from command line with both /Og (global optimizations) and in-line function expansion, /Ob1(Only __inline) or /Ob2 (Any Suitable), reproduces the error. For instance, using: cl /Og /Ob1 /GX /W4 test.cpp
Compiling with the following switch settings in command line does not produce errors: cl /Og /GX /W4 test.cpp
- or - cl /Ob1 /GX /W4 test.cpp
One workaround when using /O1 or /O2 in Developer Studio is to disable In-line function expansion (Build:Settings, C++ Tab, Optimizations category). Another workaround is to disable global optimizations. To accomplish this, choose Custom for the type of optimization (Build:Settings, C++ Tab, Optimizations category). Check all categories that apply, but do not check global optimizations. This behavior is similar to using the components of /O1 or /O2 and eliminating /Og). An additional method is to leave /O1 or /O2 intact and manually add /Og- to the Project Options.
该怎么解决?
RESOLUTION
Disable either global optimizations (/Og-) or inline function expansion (/Ob1- or /Ob2-). Please see the More Information section below.
2.Use All compile