VC++编译器致命错误C1001

来源:互联网 发布:原生js获取所有子元素 编辑:程序博客网 时间:2024/05/11 03:27

MSDN上是这样解释的:

INTERNAL COMPILER ERROR
(compiler file 'file', line number)

This error is most often generated in one of two cases:

  • Failure to recover the compiler's internal state following detection of a syntax error in the program. The first pass of the compiler will occasionally fail when attempting to recover its state following the detection of a malformed program. Typically, the compiler will have printed an error message (or messages) and will later produce an internal compiler error. In most cases, fixing the errors reported in your code and recompiling will solve the problem.

  • Failure of the code generator to find a way to generate correct code for a construct. This is most often caused by the interaction of an expression and an optimization option. The optimization has generated a tree which the compiler does not know how to handle. Such a problem can often be fixed by removing one or more optimization options when compiling the particular function containing the line indicated in the error message.

基本上产生这个错误的原因就是由于Visual Studio 6.0中的C++编译器不支持C++标准中的某些语法特征所引起的。C++标准(C++99)中的很多新的语言特征,微软的C++编译器没有提供足够支持,毕竟Visual C++中的C++编译器比较早,虽然通过安装SP6可以解决一些问题。Visual Studio 2003对C++标准的支持就要比Visual Studio 6.0要好得多。如果编程中出现这一错误,首要的解决方法就是修改哪些使用了C++标准中冷僻特性以及新语言特性的代码,使用通用的C++代码来实现相应的功能而不是利用新的C++语言特性。

注意:VIsual Studio 6.0对模板语法的支持并不完善,所以对使用了模板的代码需要特别注意!

原创粉丝点击