Skip to content

Commit fcfb86d

Browse files
authored
Merge pull request MicrosoftDocs#660 from corob-msft/Cr-c4464
Add warning C4464, update TOC, other references
2 parents 6d9aa07 + b493c12 commit fcfb86d

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "Compiler Warning (level 4) C4464 | Microsoft Docs"
3+
ms.custom: ""
4+
ms.date: "03/13/2018"
5+
ms.technology: ["cpp-tools"]
6+
ms.topic: "error-reference"
7+
f1_keywords: ["C4464"]
8+
dev_langs: ["C++"]
9+
helpviewer_keywords: ["C4464"]
10+
author: "corob-msft"
11+
ms.author: "corob"
12+
manager: "ghogen"
13+
ms.workload: ["cplusplus"]
14+
---
15+
# Compiler Warning (level 4) C4464
16+
17+
> **relative include path contains '..'**
18+
19+
A `#include` directive has a path that includes a '..' parent directory specifier.
20+
21+
## Remarks
22+
23+
Starting in Visual Studio 2015 Update 1, the compiler can detect an include directive that contains a '..' path segment and issue a warning, if enabled. Code written in this way is usually intended to include headers that exist outside of the project by incorrectly using project-relative paths. This creates a risk that the program could be compiled by including a different source file than the programmer intends, or that these relative paths would not be portable to other build environments. Although there is no specific warning for it, we also recommend that you do not use a parent directory path segment to specify your project include directories.
24+
25+
This warning is new in Visual Studio 2015 Update 1, and is off by default. Use [/Wall](../../build/reference/compiler-option-warning-level.md) to enable all warnings that are off by default, or __/w__*n*__4464__ to enable C4464 as a level *n* warning. For more information, see [Compiler Warnings That Are Off By Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md). For information on how to disable warnings by compiler version, see [Compiler warnings by compiler version](compiler-warnings-by-compiler-version.md).
26+
27+
## Example
28+
29+
Source code files that use '..' path segments can trigger this warning when the **/Wall** option is specified:
30+
31+
```cpp
32+
#include "..\headers\C4426.h" // emits warning C4464
33+
34+
// To fix this issue, specify only the header file name, and add
35+
// the absolute path to 'headers\' to your project's include directories
36+
#include "C4426.h"
37+
```

docs/error-messages/compiler-warnings/TOC.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@
303303
## [Compiler Warning (level 1) C4461](compiler-warning-level-1-c4461.md)
304304
## [Compiler Warning (level 1) C4462](compiler-warning-level-1-c4462.md)
305305
## [Compiler Warning (level 4) C4463](compiler-warning-level-4-c4463.md)
306+
## [Compiler warning (level 4) C4464](c4464.md)
306307
## [Compiler Warning (level 1) C4470](compiler-warning-level-1-c4470.md)
307308
## [Compiler Warning (level 4) C4471](compiler-warning-level-4-c4471.md)
308309
## [Compiler Warning (level 1) C4473](c4473.md)

docs/error-messages/compiler-warnings/compiler-warnings-c4400-through-c4599.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title: "Compiler Warnings C4400 Through C4599 | Microsoft Docs"
33
ms.date: "11/17/2017"
44
ms.technology: ["cpp-tools"]
55
ms.topic: "error-reference"
6-
f1_keywords: ["C4413", "C4415", "C4416", "C4417", "C4418", "C4419", "C4421", "C4423", "C4424", "C4425", "C4426", "C4427", "C4438", "C4442", "C4443", "C4444", "C4446", "C4447", "C4448", "C4449", "C4450", "C4451", "C4452", "C4453", "C4454", "C4455", "C4456", "C4457", "C4458", "C4459", "C4464", "C4472", "C4474", "C4475", "C4476", "C4478", "C4480", "C4482", "C4483", "C4491", "C4492", "C4493", "C4494", "C4495", "C4496", "C4497", "C4498", "C4499", "C4509", "C4519", "C4531", "C4542", "C4562", "C4568", "C4569", "C4573", "C4574", "C4575", "C4582", "C4583", "C4585", "C4586", "C4587", "C4588", "C4591", "C4592", "C4593", "C4594", "C4595"]
7-
helpviewer_keywords: ["C4413", "C4415", "C4416", "C4417", "C4418", "C4419", "C4421", "C4423", "C4424", "C4425", "C4426", "C4427", "C4438", "C4442", "C4443", "C4444", "C4446", "C4447", "C4448", "C4449", "C4450", "C4451", "C4452", "C4453", "C4454", "C4455", "C4456", "C4457", "C4458", "C4459", "C4464", "C4472", "C4474", "C4475", "C4476", "C4478", "C4480", "C4482", "C4483", "C4491", "C4492", "C4493", "C4494", "C4495", "C4496", "C4497", "C4498", "C4499", "C4509", "C4519", "C4531", "C4542", "C4562", "C4568", "C4569", "C4573", "C4574", "C4575", "C4582", "C4583", "C4585", "C4586", "C4587", "C4588", "C4591", "C4592", "C4593", "C4594", "C4595"]
6+
f1_keywords: ["C4413", "C4415", "C4416", "C4417", "C4418", "C4419", "C4421", "C4423", "C4424", "C4425", "C4426", "C4427", "C4438", "C4442", "C4443", "C4444", "C4446", "C4447", "C4448", "C4449", "C4450", "C4451", "C4452", "C4453", "C4454", "C4455", "C4456", "C4457", "C4458", "C4459", "C4472", "C4474", "C4475", "C4476", "C4478", "C4480", "C4482", "C4483", "C4491", "C4492", "C4493", "C4494", "C4495", "C4496", "C4497", "C4498", "C4499", "C4509", "C4519", "C4531", "C4542", "C4562", "C4568", "C4569", "C4573", "C4574", "C4575", "C4582", "C4583", "C4585", "C4586", "C4587", "C4588", "C4591", "C4592", "C4593", "C4594", "C4595"]
7+
helpviewer_keywords: ["C4413", "C4415", "C4416", "C4417", "C4418", "C4419", "C4421", "C4423", "C4424", "C4425", "C4426", "C4427", "C4438", "C4442", "C4443", "C4444", "C4446", "C4447", "C4448", "C4449", "C4450", "C4451", "C4452", "C4453", "C4454", "C4455", "C4456", "C4457", "C4458", "C4459", "C4472", "C4474", "C4475", "C4476", "C4478", "C4480", "C4482", "C4483", "C4491", "C4492", "C4493", "C4494", "C4495", "C4496", "C4497", "C4498", "C4499", "C4509", "C4519", "C4531", "C4542", "C4562", "C4568", "C4569", "C4573", "C4574", "C4575", "C4582", "C4583", "C4585", "C4586", "C4587", "C4588", "C4591", "C4592", "C4593", "C4594", "C4595"]
88
dev_langs: ["C++"]
99
ms.assetid: b07850a5-ae89-48ea-bf9a-f0e30939f9b9
1010
author: "corob-msft"
@@ -83,7 +83,7 @@ The articles in this section of the documentation explain a subset of the warnin
8383
|[Compiler Warning (level 1) C4461](../../error-messages/compiler-warnings/compiler-warning-level-1-c4461.md)|'*classname*': this class has a finalizer '!*finalizer*' but no destructor '~*dtor*'|
8484
|[Compiler Warning (level 1, Error) C4462](../../error-messages/compiler-warnings/compiler-warning-level-1-c4462.md)|'*type*' : cannot determine the GUID of the type. Program may fail at runtime.|
8585
|[Compiler warning (level 4) C4463](compiler-warning-level-4-c4463.md)|overflow; assigning '*value*' to bit-field that can only hold values from '*min_value*' to '*max_value*'|
86-
|Compiler warning (level 4) C4464|relative include path contains '..'|
86+
|[Compiler warning (level 4) C4464](../../error-messages/compiler-warnings/c4464.md)|relative include path contains '..'|
8787
|[Compiler Warning (level 1) C4470](../../error-messages/compiler-warnings/compiler-warning-level-1-c4470.md)|floating-point control pragmas ignored under /clr|
8888
|[Compiler warning (level 4) C4471](compiler-warning-level-4-c4471.md)|'*enumeration*': a forward declaration of an unscoped enumeration must have an underlying type (int assumed)|
8989
|Compiler warning (level 1) C4472|'*identifier*' is a native enum: add an access specifier (private/public) to declare a 'WinRT|managed' enum|

docs/preprocessor/compiler-warnings-that-are-off-by-default.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The following warnings are turned off by default.
5959
|[C4435](../error-messages/compiler-warnings/compiler-warning-level-4-c4435.md) (level 4)|'*class1*' : Object layout under /vd2 will change due to virtual base '*class2*'|
6060
|[C4437](../error-messages/compiler-warnings/compiler-warning-level-4-c4437.md) (level 4)|dynamic_cast from virtual base '*class1*' to '*class2*' could fail in some contexts|
6161
|C4444 (level 3)|top level '__unaligned' is not implemented in this context|
62-
|C4464 (level 4)|relative include path contains '..'|
62+
|[C4464](../error-messages/compiler-warnings/c4464.md) (level 4)|relative include path contains '..'|
6363
|C4472 (level 1)|'*identifier*' is a native enum: add an access specifier (private/public) to declare a managed enum|
6464
|[C4514](../error-messages/compiler-warnings/compiler-warning-level-4-c4514.md) (level 4)|'*function*': unreferenced inline function has been removed|
6565
|[C4536](../error-messages/compiler-warnings/compiler-warning-level-4-c4536.md) (level 4)|'type name': type-name exceeds meta-data limit of '*limit*' characters|

0 commit comments

Comments
 (0)