读书人

奇怪现象,该怎么解决

发布时间: 2012-03-03 15:33:04 作者: rapoo

奇怪现象
定义1个类,在CPP中实现构造函数会出现“C:\Program Files\Microsoft Visual Studio\MyProjects\prog1\prog1.cpp(45) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) ......
的错误,把构造函数在H中实现就么这个问题了.不知道是为是么

[解决办法]
line 1786???你这文件够长的啊,
方便的话把代码贴上来看看呗。

既然你就给出这些东西,不如看看MSDN怎么说的吧:


Error Message
INTERNAL COMPILER ERROR(compiler file file, line number)


The compiler cannot generate correct code for a construct, probably due to the combination of an expression and an optimization option. Try removing one or more optimization options and recompiling the function containing the line indicated in the error message.

You can probably fix the problem by removing one or more optimization options. To determine which option is at fault, remove options one at a time and recompile until the error message goes away. The options most commonly responsible are /Og, /Oi, and /Oa. Once you determine which option is responsible, you can disable it using the optimize pragma around the function where the error occurs and continue to use the option for the rest of the module.

The Microsoft Knowledge Base has more information about C1001; see http://support.microsoft.com/default.aspx?scid=kb;en-us;134650.

Try rewriting the line where the error is reported, or several lines of code surrounding that line. If that doesn't work, contact Microsoft Product Support Services.

[解决办法]
/*rectangleclass::rectangleclass(){
length=width=area=0; //在这里实现会报错
};*/

}后多了一个分号
[解决办法]
在VS2008中编译未出现问题,估计是楼主的编译器有些问题。

读书人网 >C++

热点推荐