用vc++2010第一次调试程序出错, 编写的程序如下:#include <iostream>int main(){ std::cout<<"Hello World\n"<<std::endl; return 0;}按F7,出现如图1的错误,按ctrl+F5出现如图2的错误,点YES出现如图3的错误,我想知道错误的原因,以及怎么解决。用以下的代码错误依旧:#include <stdio.h>int main(){printf("Hello World\n");return 0;} 图片如下:
后来检查原因:是vc 2010设置出现错误,应该这样设置: 新建一个win32控制台应用程序(名称输入hellow world) ——》确定——》下一步——》选择空白项——》完成——》视图——》解决方案资源管理器——》双击hellow world项目——》选择源文件——》右键“源文件”——》添加——》新建项目——》单击“visual c++”——》单击“c++文件(.cpp)”——》名称输入hellow world——》添加,然后在编译器里输入://hellow world //demonstratse hellow world#include<iostream>#include<windows.h>using namespace std;int main(){ cout<<"hellow world"; system("pause"); return 0;} 接着自己运行一下,ok.