# 头文件的搜索路径

讨论一下Visual Studio中头文件的搜索路径

系统自带的头文件用尖括号括起来，这样编译器会在系统文件目录下查找。

\#include \<xxx.h> 2， 用户自定义的文件用双引号括起来，编译器首先会在用户目录下查找，然后在到C++安装目录（比如VC中可以指定和修改库文件查找路径，Unix和Linux中可以通过环境变量来设定）中查找，最后在系统文件中查找。 #include “xxx.h”&#x20;

项目-属性-VC++目录-包含目录

{% embed url="<https://blog.csdn.net/jimmyleeee/article/details/83269945>" %}

<figure><img src="/files/txpHdnKygCfhn3ieGiKj" alt=""><figcaption></figcaption></figure>

通过红色部分可以看到头文件的包含路径是：$(VC\_IncludePath);$(WindowsSDK\_IncludePath); 这里是两个两个变量，还是不知道具体包含了哪些路径。

这两个变量到底包含哪些路径呢？

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\atlmfc\include

以我目前的理解，应该很多系统自带的头文件都在这里面

那么如果我想搞一个新的库文件，是不是可以直接复制到这个目录下面

或者从项目-属性-VC++目录-包含目录这里新增


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tysun.gitbook.io/c++/tou-wen-jian-de-sou-suo-lu-jing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
