转载:天南韩立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. Kafka生产者APi

    kafka客户端发布record(消息)到kafka集群. 新的生产者是线程安全的,在线程之间共享单个生产者实例,通常单例比多个实例要快. 一个简单的例子,使用producer发送一个有序的key/v ...

  2. python 模块化管理,导入自己的模块(包)

    很多东西似懂非懂,或者当时看懂了,但是感觉不是很重要,经常不用,时间久了,也就变得似懂非懂了.今天被某度电话面试问道一个问题,就是模块倒入,其实我之前也是很仔细的研究过的,不过由于平时做的东西太简单, ...

  3. VS2003在win7 64位的调试

    win7 64位下安装了VS2003 ,在调试时,一直加载不了W3P.解决方案是.打开VS时,右键已管理员身份打开,即可调试.

  4. CUDA ---- CUDA库简介

    CUDA Libraries简介 上图是CUDA 库的位置,本文简要介绍cuSPARSE.cuBLAS.cuFFT和cuRAND,之后会介绍OpenACC. cuSPARSE线性代数库,主要针对稀疏矩 ...

  5. mysql的字符拼接

    在Mysql 数据库中存在两种字符串连接操作.具体操作如下 一. 语法: 1. CONCAT(string1,string2,…)   说明 : string1,string2代表字符串,concat ...

  6. tensorflow中常用学习率更新策略

    神经网络训练过程中,根据每batch训练数据前向传播的结果,计算损失函数,再由损失函数根据梯度下降法更新每一个网络参数,在参数更新过程中使用到一个学习率(learning rate),用来定义每次参数 ...

  7. xdoj-1149(多重集合+容斥原理+组合数取模)

    #include <iostream> #include <algorithm> #include <cstdio> using namespace std; ty ...

  8. 【java规则引擎】《Drools7.0.0.Final规则引擎教程》第4章 4.2 agenda-group

    转载:https://blog.csdn.net/wo541075754/article/details/75332720 agenda-group 规则的调用与执行是通过StatelessKieSe ...

  9. YUI JS压缩Ant脚本

    <?xml version="1.0" encoding="UTF-8"?><!-- 对指定目录下的所有js进行压缩,放入指定位置 --> ...

  10. test20181005 序列

    题意 考场30分 维护差值,考虑每次移动的变更,当前2-n位置上的差加1,1位置上的差减n-1. 然后要求的是绝对值的和,用吉司机线段树维护最大最小值.次大次小值. 期望复杂度\(O(n \log n ...