我用VC新建了一个cpp文件,哪怕就写下面这点基础代码,一编译就出现下面错误,怎么回事啊,是不是我的vc哪儿没调好,本人没用过vc#include <stdio.h>
int main(void)
{
return 0;
}
编译报错如下:
--------------------Configuration: a - Win32 Debug--------------------
Compiling...
a.cpp
c:\program files\microsoft visual studio\vc98\include\stdio.h(220) : error C2144: syntax error : missing ';' before type 'int'
c:\program files\microsoft visual studio\vc98\include\stdio.h(220) : error C2501: '_CRTIMP' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\stdio.h(220) : fatal error C1004: unexpected end of file found
Error executing cl.exe.a.exe - 3 error(s), 0 warning(s)

解决方案 »

  1.   

    不要,你用vc新建一个win32控制台程序?
      

  2.   

    文件开头加上#include "stdafx.h"试试
      

  3.   

    去掉void试试看,建立一个控制台工程,应该没问题啊?
      

  4.   

    一种可能是你创建的不是win32控制台程序,一种可能是编译器出了问题
      

  5.   

    你只建了个CPP文件,没建工程吗?
      

  6.   

    楼上回答都不正确,我从安装光盘中找到stdio.h文件,拷贝替换VC安装路径下的同名文件就解决了。所以问题应该是不小心改了stdio.h文件造成的。
      

  7.   

    missing ';' before type 'int'
    说明你的int类型都不识别,你新建的what?
      

  8.   

    你是不是没有用安装包安装VC,而是把别人机器上的VC打包然后直接使用的?
      

  9.   

    clean solution->delete ncb file->rebuild again
      

  10.   

    这个写的有点单片机C的意思哈,还是按书上的来,老实写成void main()吧