电脑各种程序停止工作:c++程序问题,请指教

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/08 05:30:35
#include <iostream>
using namespace std;
class sample
{
private:int x;
public:sample(){}
sample(int a){x=a;}
void disp(){cout<<"x="<<x<<endl;}
int operator++()
{
x+=1;
return x;
}
int operator++(int flag)
{
x+=1;
return x;
}
};
void main()
{
sample ob(5);
ob.disp();
ob++;
ob.disp();
++ob;
ob.disp();
cout<<"x="<<ob++<<endl;
system("pause");
}

F:\c++\81\81.cpp(15) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
执行 cl.exe 时出错.
怎么回事啊?

你的程序没有问题,我刚刚试过了
最简单的办法是重装VC,
实际上这个问题很多情况下是由于路径设置的问题引起的,“CL.exe”是VC使用真正的编译器(编译程序),其路径在“VC根目录\VC98\Bin”下面,你可以到相应的路径下找到这个应用程序。
因此问题可以按照以下方法解决:点击VC“TOOLS(工具)”—>“Option(选择)”—>“Directories(目录)”重新设置“Excutable Fils、Include Files、Library Files、Source Files”的路径。很多情况可能就一个盘符的不同(例如你的VC装在C,但是这些路径全部在D),改过来就OK了。

你的编译器有问题吧?
在我这里运行正常的
运行结果显示:
x=5
x=6
x=7
x=8
请按任意键继续. . .