如何在使用 #include 指令时通过 VS2022 IntelliSense 仅显示项目标题

问题描述 投票:0回答:1

我重新安装了 Visual Studio 2022,由于某种原因,当我输入

#include "
时,IntelliSense 显示所有可用的头文件:

enter image description here

我不记得做了什么特殊的事情来只显示添加到项目中的标题,这是 Visual Studio 在键入

#include "
而不是
#include <
时所做的。

是否可以选择恢复旧的行为?

c++ intellisense visual-studio-2022 header-files preprocessor-directive
1个回答
0
投票

附加包含目录来看,我猜Visual Studio会按顺序搜索包含目录或附加包含目录下的头文件。

1.In the current source directory.
2.In the Additional Include Directories in the project properties (Project -> [project name] Properties, under C/C++ | General).
3.In the Include directories is available at Project Properties (Project -> [project name] Properties,Configuration → VC++ Directories

如果您想自定义搜索包含文件的目录,请尝试删除这些头文件的路径并在您的头文件文件夹中添加头文件。

测试结果: enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.