小编Fil*_*onk的帖子

如何处理 Mac 上 VS Code 中的 C++ 头文件 #include 错误?

我的 Mac 上的 VS Code 会产生头文件第三方库(本例中为wxWidgets )的#include 错误。我阅读了我能找到的所有内容,调整了“c_cpp_properties.json”中的“includePath”设置,但没有任何帮助。

\n

头文件与 .cpp 文件位于同一文件夹中(“/src/”)。该项目构建并运行良好,但 VS Code 产生 #include 错误,并且错误曲线覆盖了我的整个项目。

\n

下面是屏幕截图和带有 VS Code 设置的 JSON 文件。

\n

#包含错误截图

\n

c_cpp_properties.json:

\n
{\n    "configurations": [\n        {\n            "name": "Mac",\n            "includePath": [\n                "${workspaceFolder}/src",\n                "${workspaceFolder}/**",\n                "/usr/local/Cellar/wxmac/3.0.5.1/include/wx-3.0"\n            ],\n            "defines": [],\n            "macFrameworkPath": [\n                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"\n            ],\n            "compilerPath": "/usr/bin/g++",\n            "cStandard": "c11",\n            "cppStandard": "c++17"\n        }\n    ],\n    "version": 4\n}\n
Run Code Online (Sandbox Code Playgroud)\n

请帮我解决这个问题。

\n

\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94更新\xe2\x80\x94\xe2\x80\x94\xe2\x80\x94\ xe2\x80\x94\xe2\x80\x94

\n

建议我在c_cpp_properties.json中使用以下设置:

\n
{\n    "configurations": [\n        {\n            "name": …
Run Code Online (Sandbox Code Playgroud)

c++ clang visual-studio-code

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

c++ ×1

clang ×1

visual-studio-code ×1