安装VS简化版。解决编译器报错“Cannot open include file: 'iostream.h': No such file or directory”
来源:互联网 发布:网站引导页源码 编辑:程序博客网 时间:2024/06/05 06:00
因为微软出的VS2008什么的安装包太大了,以前安过一次而且很不成功很不爽造就了一大堆垃圾文件。
我就下了一个天朝的简化版。加上编译器一共才160M。好吧。我不广告了但的确。没必要为个C++装那么脓肿的玩意。
写了按照教程写了一个简单的测试程序,在编译的时候报错“Cannot open include file: 'iostream.h': No such file or directory”。
旧的源文件如下:
一直报上面的错误,无法通过编译。遂放狗开始搜索。。。。。
得到如下的原因和解决方法:
-----------------------------------------
#include <iostream.h > 是VC6以前的写法。
#include <iostream>
using namespace std;
这个是标准库的写法。标准库把这些个文件都放到std这个namespace里面了。
可以到VC/include看看和VC6.0的区别,是iostream而不是iostream.h。
注意 <iostream>和 <iostream.h>是两个不同的东西
<iostream>是STL库
<iostream.h>是兼容于c的库
所有STL库都在std::名空间下
std::cout是 <iostream>里面的对象
namespace std: 所有的C++ Standard Library Class都包含在这个叫std的name
space里。比如 <vector>, <iostream>, <iterator>等等。所以当你使用它们其中的class时
,需要加入这个语句,using namespace std; 不然编译器报错。
--------------------------------
按照上述的方法修改,果不其然,通过了编译。感谢提供上述解答的无名网友。
修改后的代码如下:
知道了原因就很简单了。
- 安装VS简化版。解决编译器报错“Cannot open include file: 'iostream.h': No such file or directory”
- 初学C++:编译器报错“Cannot open include file: 'iostream.h': No such file or directory”的解决方法
- fatal error C1083 Cannot open include file 'iostream.h' No such file or directory 的解决方法
- fatal error C1083 Cannot open include file 'iostream.h' No such file or directory 的解决方法
- mysql-python 安装错误: Cannot open include file: 'config-win.h': No such file or directory
- MinGW下编译C++,Cannot open include file: 'sdkddkver.h': No such file or directory的解决
- VC++6.0编译时出现fatal error C1083: Cannot open include file: 'conio.h': No such file or directory解决
- fatal error C1083: Cannot open include file: 'ProMenu.h': No such file or directory
- vs2008. Cannot Open include file: windows.h. No such file or directory
- fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
- vc编程时说“Cannot open include file: 'unistd.h': No such file or directory”
- 关于Cannot open include file: 'ceconfig.h': No such file or directory
- Cannot open include file: 'inttypes.h': No such file or directory
- fatal error C1083: Cannot open include file: 'htmlhelp.h': No such file or directory 解决办法
- fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
- Cannot open include file: 'vtkPolyDataMapper.h': No such file or directory 之类的解决办法
- fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
- fatal error C1083: Cannot open include file: 'avformat.h': No such file or directory
- HLSL学习笔记(一) —— 旋转的三角形
- gridView加链接
- mysql 触发器
- UltraEdit 删除空行与注释
- Microsoft技术asp.net小见解
- 安装VS简化版。解决编译器报错“Cannot open include file: 'iostream.h': No such file or directory”
- .def 文件 LNK1118: “READ”语句中的语法错误
- using index
- 关于ItemRenderer刷新改变值的问题
- 网页及其控件的触发事件
- [收藏]__declspec关键字详细用法
- 无法启动MSMQ服务-安装WINCC终极解决方法
- synchronized 学习
- SEO