1. #include <iostream>
  2. using namespace std;
  3. int main(void)
  4. {
  5. cout<<"Hello World!\n";
  6. return 0;
  7. }

使用命令

gcc -o test test.c

test.c:1:20: iostream: No such file or directory

杯具啊,gcc是c的编译器,g++才有c++的iostream

参考:http://www.linuxquestions.org/questions/Linux-software-2/gcc-error-iostream-no-such-file-or-directory-641330/

-------------------------------------------------------------------------

错误2:

undefined reference to `std::cout'等错误

原因

(1)gcc和g++都是GNU(组织)的一个编译器。

(2)后缀名为.c的程序和.cpp的程序g++都会当成是c++的源程序来处理。而gcc不然,gcc会把.c的程序处理成c程序。

(3)对于.cpp的程序,编译可以用gcc/g++,而链接可以用g++或者gcc -lstdc++。

总之,老拿gcc编程c++起来了。。。

对于cpp文件

main: main.o
g++ -o main main.o
main.o: main.cpp
g++ -c main.cpp
clean:
rm -rf *.o

参考:http://blog.163.com/ziber_fiver/blog/static/20433500120122157938325/

gcc error - "iostream: No such file or directory"的更多相关文章

  1. Xcode 4-PBXcp error修复-No such file or directory

    Xcode 4-PBXcp error修复-No such file or directory (2013-05-02 15:20:50) 转载▼ 标签: apple iphone ios 移动开发 ...

  2. 编译C++,找不到头文件(fatal error: string: No such file or directory)

    在androidproject中编译C++时,找不到头文件,报错例如以下: fatal error: string: No such file or directory 解决该问题须要在Android ...

  3. android 打包 /${zipalign}&quot; error=2, No such file or directory

    当我更新完android L proview之后我的打包出问题了,报错/${zipalign}" error=2, No such file or directory 排查了一下午才知道 近 ...

  4. 错 &#39;Cannot run program &quot;/home/uv/IDE/adt/sdk/platform-tools/adb&quot;: error=2, No such file or directory

    为linux平台搭建android开发环境的人,您可能会遇到问题,如下面有: 64位置linux安装64位置eclipse和64位置jdk开场后eclipse错误后 ""Canno ...

  5. 解决Error: ENOENT: no such file or directory, scandir 'D:\IdeaWork\code-front-jet\node_modules\.npminstall\node-sass\3.7.0\node-sass\vendor'

    在使用npm安装node-sass的时候,可能会出现如下的报错: Error: ENOENT: no such file or directory, scandir 'D:\IdeaWork\code ...

  6. gitbook build/serve 失败,Error: ENOENT: no such file or directory, stat ...

    我使用的 gitbook 版本 CLI version: 2.3.2 GitBook version: 3.2.3 在使用 gitbook 生成文档时,发现编译偶尔不规律性地出现错误 d:\Mine\ ...

  7. ionic cordova platform add android Cordova failed to install plugin Error: ENOENT: no such file or directory AndroidManifest.xml

    问题描述: 在ionic 项目中出现编译android 的时候 出现 Cordova failed to install plugin  Error: ENOENT: no such file or ...

  8. 解决Android Studio在Ubuntu上出现“sdk/platform-tools/adb: error=2, No such file or directory”的方法

    转载至http://blog.163.com/china_uv/blog/static/11713726720136931132385/ 刚安装Ubuntu14.5时运行Android Studio可 ...

  9. fatal error: vector: No such file or directory

    jni/mac.cpp:28:18: fatal error: vector: No such file or directory jni/mac.cpp:29:18: fatal error: me ...

随机推荐

  1. SilverLight-DataConversion: 银光数据转换

    ylbtech-SilverLight-DataConversion: 银光数据转换 1.A, Silverlight字符串格式表 1.B, 价格格式转换器 1.C, 日期时间格式转换器 1.D, 图 ...

  2. Linux下Reids的安装和使用

    简单记录一下 redis的官网:https://redis.io/ 官网介绍: Installation Download, extract and compile Redis with: $ wge ...

  3. 【性能优化】——前端性能优化之DOM

    前言:本文参考学习自 RenChao Guan的博客,来源FSUX.ME,感谢原作者,本文的思维导图为自己整理 补充: 浏览器工作流程 避免重绘和回流的四种方式的具体实现

  4. cart算法

  5. linux 文件查找实用技巧

    1.tail catalina.out -n 100000 | grep -niR com.uujimu.utils.ArticleContentReplace.replacNumToA 查找内容,并 ...

  6. 安装配置 Kafka Manager 分布式管理工具

    Kafka Manager 特性,它支持以下内容(官方译解): 管理多个群集容易检查集群状态(主题,消费者,偏移量,经纪人,副本分发,分区分配)运行首选副本选举使用选项生成分区分配,以选择要使用的代理 ...

  7. 集团管控的历史读本——Leo鉴书76

    当下中国管理咨询界比較火的课题之中的一个就是"集团管控".公司大了之后怎样正好的用人.怎样对下属分公司不失控制.怎样在二代接手之后系统仍然稳固.种种问题都在困扰着企业们.假设我们把 ...

  8. 如何在DOS窗口中显示UTF-8字符

    在中文Windows系统中,如果一个文本文件是UTF-8编码的,那么在CMD.exe命令行窗口(所谓的DOS窗口)中不能正确显示文件中的内容.在默认情况下,命令行窗口中使用的代码页是中文或者美国的,即 ...

  9. 推荐TED演讲:20岁光阴不再来(Why 30 is not the new 20)

    缘起 早上起来在电脑上看到"自强不息"群(群号)中骆宏给大家分享的视频."20岁光阴不再来",利用短暂的时间浏览了一下.就像把这个TED视频分享给很多其它的朋友 ...

  10. RTSP转RTMP-HLS网页无插件视频直播-EasyNVR功能介绍-音频开启

    EasyNVR简介 EasyNVR能够通过简单的摄像机通道配置.存储配置.云平台对接配置.CDN配置等,将统监控行业里面的高清网络摄像机IP Camera.NVR.移动拍摄设备接入到EasyNVR,E ...