title: How to deal with C++ header file #include errors in VS Code on Mac?
body: <p>VS Code on my Mac yields <strong>#include errors</strong> for <strong>header files</strong> and <strong>third-party libraries</strong> (<em>wxWidgets</em> in this case). I read everything I could find, adjusted &quot;includePath&quot; settings in &quot;c_cpp_properties.json&quot;, but nothing helps.</p>
  <p>Header files are located in the same folder as .cpp files (&quot;/src/&quot;). The project builds and runs nicely, but VS Code yields #include errors and error squiggles cover my entire project.</p>
  <p>Below is the screenshot and a JSON file with VS Code settings.</p>
  <p><a href="https://i.stack.imgur.com/qdINX.png" rel="nofollow noreferrer">#include error screenshot</a></p>
  <p>c_cpp_properties.json:</p>
  <pre><code>{
      &quot;configurations&quot;: [
          {
              &quot;name&quot;: &quot;Mac&quot;,
              &quot;includePath&quot;: [
                  &quot;${workspaceFolder}/src&quot;,
                  &quot;${workspaceFolder}/**&quot;,
                  &quot;/usr/local/Cellar/wxmac/3.0.5.1/include/wx-3.0&quot;
              ],
              &quot;defines&quot;: [],
              &quot;macFrameworkPath&quot;: [
                  &quot;/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks&quot;
              ],
              &quot;compilerPath&quot;: &quot;/usr/bin/g++&quot;,
              &quot;cStandard&quot;: &quot;c11&quot;,
              &quot;cppStandard&quot;: &quot;c++17&quot;
          }
      ],
      &quot;version&quot;: 4
  }
  </code></pre>
  <p>Please help me straighten this out.</p>
  <p>————— <strong>UPDATE</strong> —————</p>
  <p>I was recommended to use the following settings in <em>c_cpp_properties.json</em>:</p>
  <pre><code>{
      &quot;configurations&quot;: [
          {
              &quot;name&quot;: &quot;Mac&quot;,
              &quot;includePath&quot;: [
                  &quot;${workspaceFolder}/**&quot;,
                  &quot;${vcpkgRoot}/x64-osx/include&quot;,
                  &quot;/usr/local/Cellar/wxmac/3.0.5/**&quot;
              ],
              &quot;defines&quot;: [],
              &quot;macFrameworkPath&quot;: [
                  &quot;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks&quot;
              ],
              &quot;compilerPath&quot;: &quot;/usr/bin/clang&quot;,
              &quot;cStandard&quot;: &quot;c11&quot;,
              &quot;cppStandard&quot;: &quot;c++17&quot;,
              &quot;intelliSenseMode&quot;: &quot;clang-x64&quot;,
              &quot;configurationProvider&quot;: &quot;ms-vscode.cmake-tools&quot;
          }
      ],
      &quot;version&quot;: 4
  }
  </code></pre>
  <p><em>Header file</em> #include errors are gone, but the <em>third-party library</em> (&quot;WX&quot;) errors persist. In the JSON above, there is the line &quot;${vcpkgRoot}/x64-osx/include&quot; written in the &quot;includePath&quot;.</p>
  <p>This is the <a href="https://github.com/Microsoft/vcpkg" rel="nofollow noreferrer"><strong>vcpkg</strong></a> package which helps install third-party libraries easily.</p>
  <p>After installing <strong>vcpkg</strong>, I installed <em>wxWidgets</em> via <strong>vcpkg</strong>, but the library isn't linking in VS Code (builds just fine though) and I get error squiggles as shown on the screenshot below:</p>
  <p><a href="https://i.stack.imgur.com/vdSgv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vdSgv.png" alt="see squiggles – the library is an alien object for VS Code :(" /></a></p>
  <p>Could you please explain how to straighten it out?</p>