VC++ 2008的问题

来源:百度知道 编辑:UC知道 时间:2024/06/24 11:44:55
这是我的代码
#include <stdio.h>;
void main()
{
printf("hello");
}
这是编译结果
arning C4067: unexpected tokens following preprocessor directive - expected a newline
warning C4627: '#include <stdio.h>': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
a1.cpp(6) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
请问这是怎么回事,为什么VC++6上正确的代码到2008上就不对了

你输入的C语言,可能不支持。你输入:
#include<iostream.h>
main()
{
cout<<"Hello!"<<endl;
}
试试,这是C++。再不行就是你编译器有问题……
从最后一句“Did you forget to add '#include "stdafx.h"' to your source?
”来看,你可能前面忘记了加#incelude"stdafx.h"

1)include行的末尾不需要分号
2)需要添加stdafx.h