VC++ 中的 #include

本文详细介绍了VC++中#include指令的两种形式及其工作原理。包括如何使用引号形式和尖括号形式来指定包含文件的位置,以及编译器如何搜索这些文件。还解释了编译器选项/I的作用及环境变量INCLUDE的用途。

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

vc++中,#include有两种形式:
[url]http://msdn.microsoft.com/en-US/library/36k2cdd4%28v=VS.80%29.aspx
[/url]
The #include directive tells the preprocessor to treat the contents of a specified file as if those contents had appeared in the source program at the point where the directive appears.

[quote]
#include "path-spec"
#include <path-spec>
[/quote]

[quote]Quoted form(引号)

总共四个地方
This form instructs the preprocessor to look for include files in the same [b]directory of the file that contains the #include statement[/b], and then in the [b]directories of any files that include (#include) that file[/b]. The preprocessor then searches along [b]the path specified by the /I compiler option[/b], then along [b]paths specified by the INCLUDE environment variable[/b].[/quote]
[quote]
Angle-bracket form(尖括号)

两个地方
This form instructs the preprocessor to search for include files first along [b]the path specified by the /I compiler option[/b], then, when compiling from the command line, along the path specified by [b]the INCLUDE environment variable[/b].
[/quote]

至于[b]the path specified by the /I compiler option[/b],可以通过
配置属性-》c、c++-》命令行 中看到有哪些
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值