VC++编译问题,高手进.急啊搞了两天了

来源:百度知道 编辑:UC知道 时间:2024/05/08 15:25:16
错误提示是
--------------------Configuration: zxc - Win32 Debug--------------------
Compiling...
asd.cpp
c:\documents and settings\administrator\桌面\zxc\asd.cpp(1) : fatal error C1083: Cannot open precompiled header file: 'Debug/zxc.pch': No such file or directory
执行 cl.exe 时出错.

asd.obj - 1 error(s), 0 warning(s)

程序代码为:
#include <iostream.h>
void main (void)
{
float x,y;
cout<<"INPUT: x";
cin>>x;
if(x<0)
y=x+1;
else if(x<10)
y=x*x-5;
else
y=x*x*x;
cout<<"y="<<y<<endl;
}

建议改成下面形式:
iostream.h 与iostream 有很大区别,建议用后者,
参考c++ primer 4th
别忘了使用标准命名空间std;
在标准c++建议使用
int main
{}

修改后代码
#include <iostream>
using namespace std;
int main (int)
{
float x,y;
cout<<"INPUT: x";
cin>>x;
if(x<0)
y=x+1;
else if(x<10)
y=x*x-5;
else
y=x*x*x;
cout<<"y="<<y<<endl;
return 0;
}

删了Debug下的所有文件

然后选择全部重建(buile all?)

预到这情况我一般删了工程再建个新的然后把cpp加进去再编译。标准C还是用TC好

先 build(F7) 再 编译 试试

难道你的卡巴没关?