转载:天南韩立CSDN博客

  • #include<>直接从编译器自带的函数库中寻找文件
  • #include" "是先从自定义的文件中找 ,如果找不到在从函数库中寻找文件

采用"<>"方式进行包含的头文件表示让编译器在编译器的预设标准路径下去搜索相应的头文件,如果找不到则报错。

特别要注意的是,如果是标准库头文件,那么既可以采用<>的方式,又可以采用" "的方式,而用户自定义的头文件只能采用" "的方式。

例如,如下这种方式是正确的:

#include <iostream>

效率较高(编译器自带的函数库中寻找文件)

#include "iostream"

效率较低(从自定义的文件中找 ,如果找不到在从函数库中寻找文件)

如下这种方式是不正确的:

#include <helloworld.h>

helloworld.h是我们自己创建的头文件

C++中,关于#include<***.h>和#include"***.h"的区别的更多相关文章

  1. Visual Studio 中使用万能头文件 #include <bits/stdc++.h>

    最近开始使用VS,之前用的DEV C++软件可直接使用 #include <bits/stdc++.h>  ,但VS中并没有,为了使用方便,可直接在VS中添加此头文件,方法如下: 1.在安 ...

  2. #include<iostream>与#include<iostream.h>的区别

                                           转载于祝长洋的BLOG:http://blog.sina.com.cn/s/blog_514b5f600100ayks.h ...

  3. fatal error C1083: Cannot open include file: 'openssl/opensslv.h'

    在安装针对ELK系统的警告工具elastalert时,报错: fatal error C1083: Cannot open include file: 'openssl/opensslv.h',如下图 ...

  4. #include<iostream>与#include<iostream.h>以及#inclue<string> 和 #include<string.h>的区别

    转载于:http://www.cnblogs.com/charley_yang/archive/2010/12/08/1900715.html 1.从功能性的角度来讲,<iostream> ...

  5. Solve error: Cannot open include file: 'X11/Xlocale.h': No such file or directory

    When you use FLTK with VS2010, you may get the error: fatal error C1083: Cannot open include file: ' ...

  6. [C++]Linux之头文件sys/types.h[/usr/include/sys]

    1.查找<sys/types.h>文件 一般地,Linux的C头文件<sys/types.h>路径在如题的途径:/usr/include/sys下,然而博主[Linux For ...

  7. WARNING: CPU: 0 PID: 1 at ./arch/x86/include/asm/fpu/internal.h:373

    ------------[ cut here ]------------WARNING: CPU: 0 PID: 1 at ./arch/x86/include/asm/fpu/internal.h: ...

  8. mac安装protobuf2.4.1时报错./include/gtest/internal/gtest-port.h:428:10: fatal error: 'tr1/tuple' file not found和google/protobuf/message.cc:175:16: error: implicit instantiation of undefined template

    通过网上下载的protobuf2.4.1的压缩文件,然后进行安装,./configure和make时遇到了两个问题. 正常的安装步骤如下: ./configure make  make check m ...

  9. [Perl]Can't link/include C library 'ft2build.h', 'freetype', aborting.

    原文:http://www.code-by.org/viewtopic.php?f=60&t=284 错误提示 Font-FreeType-0.07>perl Makefile.PL B ...

  10. 生成JNI的DLL时提示找不到jni.h的解决的方法Cannot open include file: &#39;jni.h&#39;: No such file or directory

    解决的方法: 就是到jdk的安装文件夹下include下把下面对应的文件,拷贝到vc文件夹下的include文件夹下 \jdk\include\jni.h \jdk\include\win32\jaw ...

随机推荐

  1. 返回最小的k个数

    对于一个无序数组,数组中元素为互不相同的整数,请返回其中最小的k个数,顺序与原数组中元素顺序一致. 给定一个整数数组A及它的大小n,同时给定k,请返回其中最小的k个数. 测试样例: [1,2,4,3] ...

  2. python笔记05:条件、循环和其它语句

    5.1 print和import的更多使用方式 5.1.1 使用逗号输出 print 'Age',42 print 1,2,3 如果要同时输出文本和变量值,又不希望使用字符串格式化的话,那么这个特性就 ...

  3. ESET Smart Security 6 – 免费60天(SG)

    ESS 60天 - 活动消息来自新加坡脸谱https://www.facebook.com/esetsingapore/app_190322544333196IP限制Sg,suiss提供个在线代理ht ...

  4. vmware Esxi 回收Thin模式磁盘空间

    本文来自:https://blog.csdn.net/happyfreeangel/article/details/85075179 第一部分 回收Thin模式磁盘空间背景:在使用Thin模式的磁盘, ...

  5. anu - reactIE

    import { options } from "./util"; import { Children } from "./Children"; import ...

  6. sprintf 函数

    //$tick 保留{$decimalplaces}位小数,不够位数的小数点后面用0 填充$tick = sprintf( "%.0${decimalplaces}lf ", $i ...

  7. php and mysql 常用api函数

  8. jsp参考手册

    DHTML手册javascript programmer's reference

  9. SWIFT 之CoreData初试

    SWIFT中使用CoreData来保存本地数据,在建立项目的时候把 "Use Core Data"选项选上 项目建立完成后点击后缀为 .xcdatamodeld的那个文件,点击右下 ...

  10. nginx -s stop and -s quit 有什么区别?

    Quit is a graceful shutdown. Nginx finishes serving the open connections before shutdown Quit 是一个优雅的 ...