C++ 运行"hello world" vs2010 时出错

C++ error runing "hello world", vs2010

本文关键字:出错 vs2010 hello 运行 C++ world      更新时间:2023-10-16
#include <iostream>
using namespace std;
int main()
{
    cout<<"hello world!"<<endl;
    return 0;
}

我正在尝试在 vs2010 中运行这个最简单的代码,但在编译它时收到了 100 多个错误。

f:vs2010vcincludefstream(14): error C2143: syntax error : missing ';' before '*' 
f:vs2010vcincludefstream(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
f:vs2010vcincludefstream(16): error C2653: 'ios_base' : is not a class or namespace name
f:vs2010vcincludefstream(16): error C2061: syntax error : identifier 'openmode'
f:vs2010vcincludefstream(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

像这样的错误。我该怎么办?

尝试将此练习包含在代码中

#include "stdafx.h"