ARM Technical Support Knowledge Articles

DIFFERENCES BETWEEN #INCLUDE <FILE> AND "FILE"

Applies to: General Topics

Answer

Information in this article applies to:


SYMPTOMS

If you copy an include file from the KEILCxxINC folder to your project folder and attempt to include it using:

#include <filename.h>

the original file from the INC folder is included instead of the copy.

CAUSE

This is correct behavior. The ANSI standard differentiates between

#include <filename>

and

#include "filename"

The ANSI standard does not specify a search order but recommends that #include <filename> should search implementation-defined locations for header files.

In the Keil C compiler (and most other C compiler implementations) the include file search is implemented as follows:

In the uVision IDE, you may view or change the search path the compiler uses for #include <> statements. From the Project window, click on Project, then Components, Environment, Books to display the Components, Environment, Books dialog. Clicking on the Folders/Extensions tab displays the folders searched by the compiler, assembler and linker. The compiler uses the path name in INC text box for #include <> statements.

RESOLUTION

Use the following preprocessor directive to include your modified header file.

#include "filename.h"

MORE INFORMATION

SEE ALSO

Article last edited on: 2007-03-27 10:52:17

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential