INFO: Include Directories Not Searched as ExpectedLast reviewed: October 1, 1997Article ID: Q38383 |
The information in this article applies to:
SUMMARYIt may appear that the C compiler searches the INCLUDE list in the wrong order. While the search order for a file enclosed in brackets (<>) is simple, the order for a file enclosed in double quotation marks ("") is different and more complicated.
MORE INFORMATIONNOTE: Using double quotation marks around a complete path specification causes the standard directories to NOT be searched. As documented in the "Include Files" section of the Visual C++, 16-bit edition, "Microsoft C Language Reference," and "The #include Directive" section of the Visual C++, 32-bit edition, "Preprocessor Reference," the search order for a statement like "#include <file.h>" is as follows:
#include "\path\file.h"The standard directories are not searched. However, the search order for
#include "file.h"is similar to the search order for
#include <file.h>except that "parent directories" are searched before directories specified by the /I switch and before directories specified in the INCLUDE environment variable. The parent directory is the directory that contains the source containing the #include directive. If #include files are nested, then the parent directories are searched in reverse order of the nesting: first parents, then grandparents, and so on. For example, if source file GRANDMA.C contains
#include <parent.h>and PARENT.H contains
#include "child.h"the search for CHILD.H will take place in the following order:
|
Additional query words: 8.00 8.00c 9.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |