C++ 在使用预编译头文件时,使用vscode在intellisense中自动包含头文件

C++ 在使用预编译头文件时,使用vscode在intellisense中自动包含头文件,c++,visual-studio-code,intellisense,C++,Visual Studio Code,Intellisense,我在macOS 10.15上,我正在为一个项目使用vscode。对于这个项目,我设置了预编译头。编译工作正常,但我的文件中不包括预编译的头文件。相反,它们包含在编译器选项-include pch.hpp(如上所述)中。问题是,因为我的文件中没有包含这些内容,IntelliSense无法正常工作,而且我有很多包含错误。在c_cpp_properties.json中,我试图添加行 "compilerArgs": [ "-include ${workspaceFolder}/emulator/pch.

我在macOS 10.15上,我正在为一个项目使用vscode。对于这个项目,我设置了预编译头。编译工作正常,但我的文件中不包括预编译的头文件。相反,它们包含在编译器选项
-include pch.hpp
(如上所述)中。问题是,因为我的文件中没有包含这些内容,IntelliSense无法正常工作,而且我有很多包含错误。在
c_cpp_properties.json中,我试图添加行

"compilerArgs": [
"-include ${workspaceFolder}/emulator/pch.hpp"
]
但它不起作用,错误仍然存在。有没有办法告诉IntelliSense自动包含一个文件

我以前做的就是

#ifndef构建
#包括“pch.hpp”
#恩迪夫

在我所有其他文件中包含的
util.hpp
文件中,并在编译时使用
-DBUILD
定义生成。问题是,每当我修改我的
util.hpp
文件时,我都必须重新创建我的预编译头文件,因为我有一个错误,clang告诉我我的
util.hpp
文件比预编译头文件新。

使用forcedInclude,c\u cpp\u properties.json:

"configurations": [
    {
       ...
       "forcedInclude": ["${workspaceFolder}/include/config.h"],
       ...
    }
]