fatal error C1001: INTERNAL COMPILER ERROR (compil

2019-05-17 21:37发布

问题:

I tried to compile a project with Visual Studio 6 SP6 and got the following:

usbcore.h(18) : fatal error C1001: INTERNAL COMPILER ERROR
    (compiler file 'msc1.cpp', line 1794)
     Please choose the Technical Support command on the Visual C++
     Help menu, or open the Technical Support help file for more information

Line 18 of usbcore.h contains the include directive:

18: #include "usbiface.h"

Empty or non-existing usbiface.h produces the same error. I commented this line and got the same error but for the next include file.

To sum this up: the compiler error occurs for each #include directive that refers to the common project headers.

回答1:

In my case, changing the tag WholeProgramOptimizationtrue from true to false fixed the problem.



回答2:

I figured out what caused that error. One of the include paths (passed to a compiler with the /I switch) had a trailing backslash.

The compiler cmdline is: CPP /nologo /MT /W3 /GX /Zi /Od /I "$(ZLIB_PATH)" /I "..\headers"

and ZLIB_PATH had a trailing backshlash. Removing that backslash solved the problem.



回答3:

I ran into this problem when I left the parenthesis off of the definition of a ctor. It was a stupid error but it was very taxing to check out all of these tough fixes. So I just offer this as a possibility. I would not have expected an internal compiler error.



回答4:

In my case (VC6.0 SP6a), it is due to the confusing using statement. It seems the compiler can't determine whether I'm defining Foo::Bar or Bar (in global namespace).

namespace Foo {
    class Bar;
}

using Foo::Bar;

class Bar {
};