VS Code on my Mac yields #include errors for header files and third-party libraries (wxWidgets in this case). I read everything I could find, adjusted "includePath" settings in "c_cpp_properties.json", but nothing helps.
Header files are located in the same folder as .cpp files ("/src/"). The project builds and runs nicely, but VS Code yields #include errors and error squiggles cover my entire project.
Below is the screenshot and a JSON file with VS Code settings.
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
}
Please help me straighten this out.
————— UPDATE —————
I was recommended to use the following settings in c_cpp_properties.json:
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"${vcpkgRoot}/x64-osx/include",
"/usr/local/Cellar/wxmac/3.0.5/**"
],
"defines": [],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
Header file #include errors are gone, but the third-party library ("WX") errors persist. In the JSON above, there is the line "${vcpkgRoot}/x64-osx/include" written in the "includePath".
This is the vcpkg package which helps install third-party libraries easily.
After installing vcpkg, I installed wxWidgets via vcpkg, but the library isn't linking in VS Code (builds just fine though) and I get error squiggles as shown on the screenshot below:
Could you please explain how to straighten it out?
