Including header files using "" vs <>

本文详细解释了C语言中预处理指令#include的不同用法。使用&lt;header.h&gt;时,编译器会在系统头文件目录中搜索指定的头文件;而使用header.h时,编译器会首先在当前目录下查找头文件,若未找到则继续在系统头文件目录中查找。文章通过示例说明了两种不同引用方式的区别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

when using #include to include header files,
  • If using <header.h>, the compiler will search the header file in the system header folder.
  • If using "header.h", the compiler will search the header file in the current folder first; if not found, it will search the header file in the system header folder.
  • In A.cpp, if using #include <A.h>,the following error message will show “fatal error C1083: Cannot open include file: 'A.h': No such file or directory”。using #include "A.h" can resolve this issue.
  • In a word,<> can be replaced with "", but "" can not be replaced with <>.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值