#include

#include

The #include directive causes the C preprocessor to include the contents of the specified file in the compilation before continuing with the rest of the current file. The #include directive may be used to specify two different types of header (or include) files: system header files and user header files.

System header files are included as follows:

#include <filename>

These include files are installed in the \INC\ folder. They are a part of the Keil development tools release and should not be modified. When a system header file is specified, the compiler searches for the file in the following folders in order:

  • Paths specified by the directive.
  • Paths specified by the environment variable.

User header files are included as follows:

#include "filename"

These include files are user-created and may reside anywhere on your computer. When a user header file is specified, the compiler searches for the file in the following folders in order:

  • The current folder.
  • The source file folder.
  • Paths specified by the directive.
  • Paths specified by the environment variable.

Note

  • Include files usually have an extension of .H indicating they are Header files. We recommend you use this standard for your user header files.
  • Typically, include files contain only variable declarations (not definitions), macro definitions, and definitions for .
  • Include files may contain variable definitions. However, you must make certain that the such a header file is only included in one C file in your project. Otherwise, multiple variables with the same name may be defined resulting in linker errors. We recommended that you do not define variables or functions in include files.
  • It is possible to begin or end a function in an include file. It is also possible to put function and variable definitions in include files. While these kinds of things are possible, they are very confusing and are not good coding habits to get into. Therefore, we do not recommend that you do them.

Refer to for a complete description of how to use include files in your C programs.

Copyright (c) Keil - An ARM Company. All rights reserved.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值