1. 程式人生 > >VC++編譯器致命錯誤C1001

VC++編譯器致命錯誤C1001

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對模板語法的支援並不完善,所以對使用了模板的程式碼需要特別注意!