转载:天南韩立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. MinGW的gdb调试

        MinGW(Minimalist GNU for Windows)提供了一套简单方便的Windows下的基于GCC程序开发环境.MinGW收集了一系列免费的Windows是用的头文件和库文件: ...

  2. Microsoft 数据访问组件 (MDAC) 的版本历史记录

    http://support.microsoft.com/kb/231943/zh-cn http://support.microsoft.com/kb/301202

  3. 最小生成树之克鲁斯卡尔(Kruskal)算法

    学习最小生成树算法之前我们先来了解下 下面这些概念: 树(Tree):如果一个无向连通图中不存在回路,则这种图称为树. 生成树 (Spanning Tree):无向连通图G的一个子图如果是一颗包含G的 ...

  4. 使用OpenSSL生成证书并配置Https

    1.密钥.证书请求.证书概要说明 在证书申请签发过程中,客户端涉及到密钥.证书请求.证书这几个概念.我们以申请证书的流程说明三者的关系.客户端(相对于CA)在申请证书的时候,大体上有三个步骤: 第一步 ...

  5. 使用MyEclipse设置所需配置的iOS应用

    MyEclipse个人授权 折扣低至冰点!立即开抢>> [MyEclipse最新版下载] 一.iOS应用程序配置要求 这个进程需要四个需求数据文件: 证书签名请求(CSR)文件 证书签名请 ...

  6. svn断开重连,避免重建工作空间

    1. 右键项目-->Team-->断开连接 2.选择从文件系统中删除SVN元信息 3.右键项目-->Team-->share project-->svn 4.创建新的资源 ...

  7. anu - children

    import { _flattenChildren } from "./createElement"; export const Children = { only(childre ...

  8. CentOS 6.6安装postgresql9.6.6

    一.环境介绍 系统平台:CentOS release 6.6 (Final) Postgresql:postgresql-9.6.6 二.安装过程 1.安装依赖包 yum -y install gcc ...

  9. iOS被开发者遗忘在角落的NSException-其实它很强大

    NSException是什么? 最熟悉的陌生人,这是我对NSException的概述,为什么这么说呢?其实很多开发者接触到NSException的频率非常频繁,但很多人都不知道什么是NSExcepti ...

  10. FreeModbus undefined reference to `pthread_create'

    /********************************************************************************* * FreeModbus unde ...