我用vc6.0老是出错

来源:百度知道 编辑:UC知道 时间:2024/06/05 17:06:49
我把书上的程序打上去,无论怎样都有这样一个错误
g:\tddownload\bfj\nsfo.cpp(12) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Generating Code...
执行 cl.exe 时出错.

bfj.exe - 1 error(s), 0 warning(s)
这是我打的书上的程序:
#include<stdio.h>
void main()
{int x,y,z;
x=3;y=2;z=0;
x+=y+=z;
printf("%d\n",x<y);
z=y=x++*3;
printf("%d,%d\n",y>=z,x);
x=y>z>=5;
printf("%d,%d,%d\n",x,y,z);
}
我把这加上去了,还是错....
G:\TDdownload\bfj\nsfo.cpp(10) : warning C4804: '>=' : unsafe use of type 'bool' in operation
Linking...
nsfo.obj : error LNK2005: _main already defined in bfj.obj
Debug/bfj.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.

bfj.exe - 1 error(s), 0 warning(s)

工程要求一个预编译文件,一般是叫stdafx.h
每个cpp文件中必须#include "stdafx.h"
可能是被被你删除了或者是怎么回事

取消预编译功能就可以了:
工程--设置--C++选项卡--分类下拉列表里选择 预编译的头文件,选择不使用预补偿页眉--确定
这样以后编译速度可能会比较慢