What is the correct macOS vscode intellisense C ++ include paths for the standard library?

I am using Visual Studio Code 1.14.2 on macOS Sierra and have installed the Microsoft C / C ++ extension ms-vscode.cpptools

, but I am having trouble setting the included paths to get the standard library headers to be validated correctly by IntelliSense without generating errors and back to the engine "Tag Parser".

Default c_cpp_properties.json

contains the following version of this release vscode:

{
  "configurations": [
    {
      "name": "Mac",
      "includePath": [
        "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
        "/usr/local/include",
        "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include",
        "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
        "/usr/include",
        "${workspaceRoot}"
      ],
      "defines": [],
      "intelliSenseMode": "clang-x64",
      "browse": {
        "path": [
          "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
          "/usr/local/include",
          "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include",
          "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
          "/usr/include",
          "${workspaceRoot}"
        ],
        "limitSymbolsToIncludedHeaders": true,
        "databaseFilename": ""
      }
    },
...
}

      

For example with a simple C ++ file like:

#include <exception>

int main() {
    return 0;
}

      

Underlined #include <exception>

. Hovering over it reads:

file: 'file: ///path/to/vscode.cc' severity: "Information" message: '#include errors encountered. Update your includePath. The IntelliSense functions for this translation unit (/path/to/vscode.cc) will be provided by Tag Parser. 'at:' 1,1 'source:' '

and

file: 'file: ///path/to/vscode.cc' severity: "Info" message: 'cannot open source file "endian.h" (dependency on "exception")' at: '1,1' source : ''

I searched my filesystem for endian.h

. Cutting off features that are really relevant to host development (like removing iOS / WatchOS / etc):

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/i386/endian.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/machine/endian.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/endian.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/machine/endian.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/i386/endian.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/machine/endian.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/i386/endian.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/endian.h
/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/i386/endian.h
/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/machine/endian.h
/usr/include/i386/endian.h
/usr/include/machine/endian.h

      

Does anyone know what is the correct solution for this problem?

+3


source to share


1 answer


This turned out to be a configuration error in the IntelliSense engine. Mac headers expected the character to __LITTLE_ENDIAN__

be defined, and it is not. We fixed this issue in the last update of the extension, so you no longer need to add the path to endian.h.



+3


source







All Articles