Mac上的VS代码对头文件和第三方库产生#include错误(在这种情况下为WXMac)。我阅读了所有可以找到的内容,并在“ c_cpp_properties.json”中调整了“ includePath”设置,但无济于事。
头文件与.cpp文件(“ / src /”)位于同一文件夹中。该项目的构建和运行良好,但是VS Code产生#include错误,并且错误代码覆盖了我的整个项目。
下面是屏幕截图和带有VS Code设置的JSON文件。
c_cpp_properties.json:
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/src",
"${workspaceFolder}/**",
"/usr/local/Cellar/wxmac/3.0.5.1/include/wx-3.0"
],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}
[请帮助我理顺这一点。
在includePath
属性上,将**
添加到目录路径的末尾:
...
"includePath": [
"${workspaceFolder}/src/**",
"${workspaceFolder}/**",
"/usr/local/Cellar/wxmac/3.0.5.1/include/wx-3.0/**"
],
您可以在c_cpp_properties.json
上查找有关documentation的更多详细信息,>