You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
helpviewer_keywords: ["/I compiler option [C++]", "Additional Include Directories compiler option", "I compiler option [C++]", "-I compiler option [C++]", "set include directories", "include directories, compiler option [C++]"]
7
7
ms.assetid: 3e9add2a-5ed8-4d15-ad79-5b411e313a49
8
8
---
9
-
# /I (Additional include directories)
9
+
# `/I` (Additional include directories)
10
10
11
11
Adds a directory to the list of directories searched for include files.
12
12
13
13
## Syntax
14
14
15
-
> **/I**[]*directory*
15
+
> **`/I`***directory*
16
16
17
17
### Arguments
18
18
19
-
*directory*<br/>
20
-
The directory to be added to the list of directories searched for include files.
19
+
*directory*\
20
+
The directory to add to the list of directories searched for include files. The space between `/I` and *directory* is optional. Directories that include spaces must be enclosed in double quotes. A directory may be an absolute path or a relative path.
21
21
22
22
## Remarks
23
23
24
24
To add more than one directory, use this option more than once. Directories are searched only until the specified include file is found.
25
25
26
-
You can use this option with the ([/X (Ignore Standard Include Paths)](x-ignore-standard-include-paths.md)) option.
26
+
You can use this option on the same command line as the ([`/X` (Ignore standard include paths)](x-ignore-standard-include-paths.md)) option.
27
+
28
+
A [`#include` directive](../../preprocessor/hash-include-directive-c-cpp.md) can be specified in double-quote (or local-first) form, for example, `#include "local.h"`. Or, it can be specified in angle-bracket (or include-path-first) form, for example, `#include <iostream>`.
27
29
28
30
The compiler searches directories in the following order:
29
31
30
-
1. If specified using a [#include directive](../../preprocessor/hash-include-directive-c-cpp.md) in double-quote form, it first searches local directories. The search begins in the same directory as the file that contains the **#include**statement. If this fails to find the file, it searches in the directories of the currently opened include files, in the reverse order in which they were opened. The search begins in the directory of the parent include file and continues upward through the directories of any grandparent include files.
32
+
1. If the **`#include`** directive is specified using double-quote form, it first searches local directories. The search begins in the same directory as the file that contains the **`#include`**directive. If it fails to find the file, it searches next in the directories of the currently opened include files, in the reverse order in which they were opened. The search begins in the directory of the parent include file and continues upward through the directories of any grandparent include files.
31
33
32
-
1. If specified using a **#include** directive in anglebracket form, or if the local directory search has failed, it searches directories specified by using the **/I** option, in the order that CL encounters them on the command line.
34
+
1. If the **`#include`** directive is specified in angle-bracket form, or if the local directory search has failed, it searches directories specified by using the **`/I`** option, in the order they're specified on the command line.
33
35
34
-
1. Directories specified in the **INCLUDE** environment variable.
36
+
1. Directories specified in the **`INCLUDE`** environment variable.
35
37
36
38
### To set this compiler option in the Visual Studio development environment
37
39
38
40
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
1. Modify the **Additional Include Directories** property.
44
+
1. Modify the **Additional Include Directories** property. You can specify more than one directory at a time in this property. Directories must be separated by a semicolon (**`;`**).
43
45
44
46
### To set this compiler option programmatically
45
47
46
48
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalIncludeDirectories%2A>.
47
49
48
50
## Example
49
51
50
-
The following command looks for the include files requested by MAIN.c in the following order: First, if specified by using double-quotes, local files are searched. Next, search continues in the \INCLUDE directory, then in the \MY\INCLUDE directory, and finally in the directories assigned to the INCLUDE environment variable.
52
+
The following command looks for the include files requested by *`main.c`* in the following order: First, if specified by using double-quotes, local files are searched. Next, search continues in the *`\include`* directory, then in the *`\my\include`* directory, and finally in the directories assigned to the **`INCLUDE`** environment variable, in left to right order.
helpviewer_keywords: ["/X compiler option [C++]", "include files, ignore standard path", "-X compiler option [C++]", "include directories, ignore standard", "X compiler option", "Ignore Standard Include Paths compiler option"]
7
7
ms.assetid: 16bdf2cc-c8dc-46e4-bdcc-f3caeba5e1ef
8
8
---
9
9
# `/X` (Ignore standard include paths)
10
10
11
-
Prevents the compiler from searching for include files in directories specified in the PATH and INCLUDE environment variables.
11
+
Prevents the compiler from searching for include files in directories specified in the `PATH` and `INCLUDE` environment variables.
12
12
13
13
## Syntax
14
14
@@ -32,7 +32,7 @@ You can use this option with the [`/I` (Additional include directories)](i-addit
32
32
33
33
## Example
34
34
35
-
In the following command, **`/X`** tells the compiler to ignore locations specified by the PATH and INCLUDE environment variables, and **`/I`** specifies the directory to look in for include files:
35
+
In the following command, **`/X`** tells the compiler to ignore locations specified by the `PATH` and `INCLUDE` environment variables, and **`/I`** specifies the directory to look in for include files:
Copy file name to clipboardExpand all lines: docs/code-quality/code-analysis-for-c-cpp-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ C:\>cl /analyze Sample.cpp
40
40
41
41
## #pragma support
42
42
43
-
You can use the `#pragma` directive to treat warnings as errors; enable or disable warnings, and suppress warnings for individual lines of code. For more information, see [Pragma Directives and the __Pragma Keyword](../preprocessor/pragma-directives-and-the-pragma-keyword.md).
43
+
You can use the `#pragma` directive to treat warnings as errors; enable or disable warnings, and suppress warnings for individual lines of code. For more information, see [Pragma directives and the `__pragma` and `_Pragma` keywords](../preprocessor/pragma-directives-and-the-pragma-keyword.md).
Names the code section where the specified function definitions are to reside. The pragma must occur between a function declarator and the function definition for the named functions.
11
+
Names the code section where the specified function definitions are placed. The pragma must occur between a function declarator and the function definition for the named functions.
The **alloc_text** pragma does not handle C++ member functions or overloaded functions. It is applicable only to functions declared with C linkage — that is, functions declared with the **extern "C"** linkage specification. If you attempt to use this pragma on a function with C++ linkage, a compiler error is generated.
19
+
The **`alloc_text`** pragma doesn't handle C++ member functions or overloaded functions. It's applicable only to functions declared with C linkage, that is, functions declared with the **`extern "C"`** linkage specification. If you attempt to use this pragma on a function with C++ linkage, a compiler error is generated.
20
20
21
-
Since function addressing using **`__based`**is not supported, specifying section locations requires the use of the **alloc_text** pragma. The name specified by *textsection* should be enclosed in double quotation marks.
21
+
Since function addressing using **`__based`**isn't supported, specifying section locations requires the use of the **`alloc_text`** pragma. The name specified by *text-section* should be enclosed in double quotation marks.
22
22
23
-
The **alloc_text** pragma must appear after the declarations of any of the specified functions and before the definitions of these functions.
23
+
The **`alloc_text`** pragma must appear after the declarations of any of the specified functions and before the definitions of these functions.
24
24
25
-
Functions referenced in an **alloc_text** pragma should be defined in the same module as the pragma. Otherwise, if an undefined function is later compiled into a different text section, the error may or may not be caught. Although the program will usually run correctly, the function will not be allocated in the intended sections.
25
+
Functions referenced in an **`alloc_text`** pragma should be defined in the same module as the pragma. Otherwise, if an undefined function is later compiled into a different text section, the error may or may not be caught. Although the program will usually run correctly, the function won't be allocated in the intended sections.
26
26
27
-
Other limitations on **alloc_text** are as follows:
27
+
Other limitations on **`alloc_text`** are as follows:
28
28
29
29
- It can't be used inside a function.
30
30
31
31
- It must be used after the function has been declared, but before the function has been defined.
32
32
33
33
## See also
34
34
35
-
[Pragma directives and the __pragma keyword](../preprocessor/pragma-directives-and-the-pragma-keyword.md)
35
+
[Pragma directives and the `__pragma` and `_Pragma` keywords](./pragma-directives-and-the-pragma-keyword.md)
To use the **auto_inline** pragma, place it before and immediately after, not inside, a function definition. The pragma takes effect as soon as the first function definition after the pragma is seen.
19
+
To use the **`auto_inline`** pragma, place it before and immediately after, not inside, a function definition. The pragma takes effect as soon as the first function definition after the pragma is seen.
20
20
21
21
## See also
22
22
23
-
[Pragma directives and the __pragma keyword](../preprocessor/pragma-directives-and-the-pragma-keyword.md)
23
+
[Pragma directives and the `__pragma` and `_Pragma` keywords](./pragma-directives-and-the-pragma-keyword.md)
(Optional) Puts a record on the internal compiler stack. A **push** can have an *identifier* and *section-name*.
20
+
**`push`**\
21
+
(Optional) Puts a record on the internal compiler stack. A **`push`** can have an *identifier* and *section-name*.
22
22
23
-
**pop**\
24
-
(Optional) Removes a record from the top of the internal compiler stack. A **pop** can have an *identifier* and *section-name*. You can pop multiple records using just one **pop** command by using the *identifier*. The *section-name* becomes the active BSS section name after the pop.
23
+
**`pop`**\
24
+
(Optional) Removes a record from the top of the internal compiler stack. A **`pop`** can have an *identifier* and *section-name*. You can pop multiple records using just one **`pop`** command by using the *identifier*. The *section-name* becomes the active BSS section name after the pop.
25
25
26
26
*identifier*\
27
-
(Optional) When used with **push**, assigns a name to the record on the internal compiler stack. When used with **pop**, the directive pops records off the internal stack until *identifier* is removed. If *identifier* isn't found on the internal stack, nothing is popped.
27
+
(Optional) When used with **`push`**, assigns a name to the record on the internal compiler stack. When used with **`pop`**, the directive pops records off the internal stack until *identifier* is removed. If *identifier* isn't found on the internal stack, nothing is popped.
28
28
29
29
*"section-name"*\
30
-
(Optional) The name of a section. When used with **pop**, the stack is popped and *section-name* becomes the active BSS section name.
30
+
(Optional) The name of a section. When used with **`pop`**, the stack is popped and *section-name* becomes the active BSS section name.
31
31
32
32
*"section-class"*\
33
33
(Optional) Ignored, but included for compatibility with versions of Microsoft C++ earlier than version 2.0.
@@ -36,13 +36,13 @@ Specifies the section (segment) where uninitialized variables are stored in the
36
36
37
37
A *section* in an object file is a named block of data that's loaded into memory as a unit. A *BSS section* is a section that contains uninitialized data. In this article, the terms *segment* and *section* have the same meaning.
38
38
39
-
The **bss_seg** pragma directive tells the compiler to put all uninitialized data items from the translation unit into a BSS section named *section-name*. In some cases, use of **bss_seg** can speed load times by grouping uninitialized data into one section. By default, the BSS section used for uninitialized data in an object file is named `.bss`. A **bss_seg** pragma directive without a *section-name* parameter resets the BSS section name for the subsequent uninitialized data items to `.bss`.
39
+
The **`bss_seg`** pragma directive tells the compiler to put all uninitialized data items from the translation unit into a BSS section named *section-name*. In some cases, use of **`bss_seg`** can speed load times by grouping uninitialized data into one section. By default, the BSS section used for uninitialized data in an object file is named `.bss`. A **`bss_seg`** pragma directive without a *section-name* parameter resets the BSS section name for the subsequent uninitialized data items to `.bss`.
40
40
41
-
Data allocated using the **bss_seg** pragma does not retain any information about its location.
41
+
Data allocated using the **`bss_seg`** pragma does not retain any information about its location.
42
42
43
-
For a list of names that shouldn't be used to create a section, see [/SECTION](../build/reference/section-specify-section-attributes.md).
43
+
For a list of names that shouldn't be used to create a section, see [`/SECTION`](../build/reference/section-specify-section-attributes.md).
44
44
45
-
You can also specify sections for initialized data ([data_seg](../preprocessor/data-seg.md)), functions ([code_seg](../preprocessor/code-seg.md)), and const variables ([const_seg](../preprocessor/const-seg.md)).
45
+
You can also specify sections for initialized data ([`data_seg`](../preprocessor/data-seg.md)), functions ([`code_seg`](../preprocessor/code-seg.md)), and const variables ([`const_seg`](../preprocessor/const-seg.md)).
46
46
47
47
You can use the [DUMPBIN.EXE](../build/reference/dumpbin-command-line.md) application to view object files. Versions of DUMPBIN for each supported target architecture are included with Visual Studio.
48
48
@@ -66,4 +66,4 @@ int main() {
66
66
67
67
## See also
68
68
69
-
[Pragma directives and the __pragma keyword](../preprocessor/pragma-directives-and-the-pragma-keyword.md)
69
+
[Pragma directives and the `__pragma` and `_Pragma` keywords](./pragma-directives-and-the-pragma-keyword.md)
0 commit comments