vc++编译不过看下

来源:百度知道 编辑:UC知道 时间:2024/05/22 01:42:42
include<iostream.h>
main()
{
int i=5;
cout<<i;

}

首先要你建立控制台工程,只有工程正确了才有正确的编译设置

#include "stdafx.h" //如果你建的是一个控制台工程那这个默认是要有的
#include <iostream.h> //你要加#,这个不能没有
main()
{
int i=5;
cout<<i;
}

include <iostream>
using namespace std;//这里是关键,你没有

int main()//按照标准c++,main函数是要有返回值的,有的编译器可以没有,但是标准c++是要有的
{
int i=5;
cout<<i;
return 0;
}

楼上的少扯了,人家用的是旧版的iostream.h,可以没有名空间的。

我估计是你把工程类型建错了。这个程序,明显是WIN32控制台程序。

看看工程的设置.