Vscode-cpptools: IntelliSense include error on Mac: cannot open source file "stdarg.h"

Created on 18 Oct 2017  路  8Comments  路  Source: microsoft/vscode-cpptools

Similar to #850. I'm running VS code 1.17.2 on High Sierra
Sample code that shows that error:

#include <iostream>

int main(){
}
Language Service more info needed

Most helpful comment

Go to settings.json and change:
C_Cpp.intelliSenseEngine": "Default" to "Tag Parser"

All 8 comments

Sounds like a problem with your c_cpp_properties.json file. Could you provide it?

I also met the same problem. It shows error message for:#include <iostream>
I am a super rookie, used Xcode before. So I have no idea what does the error means.

If you can share your c_cpp_properties.json file (use the "C/Cpp: Edit Configurations" command to open the file), we can help you figure this out. I suspect that the path we chose for your Mac is incorrect and we will be addressing this with #679.

Sure, here it is:

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "/usr/include/c++/4.2.1",
                "/usr/local/include",
                "/usr/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include/c++/4.2.1",
                    "/usr/local/include",
                    "/usr/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ]
        },
        {
            "name": "Linux",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },
        {
            "name": "Win32",
            "includePath": [
                "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
                "${workspaceRoot}"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE"
            ],
            "intelliSenseMode": "msvc-x64",
            "browse": {
                "path": [
                    "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 3
}

I have the same issue. locate shows me that the libc headers seem to have moved to

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include

If I add this to the includes, everything is fine. What version of Xcode are you using? I have a feeling that this might be a change that has been introduced with Xcode 9 or 9.1, as every used to work fine for me in the past.

I am able to reproduce this problem with Xcode 9.1 on my classmate's macOS 10.13.1 High Sierra; simply include any .h header files and IntelliSense does not work.

@DirtyHairy's comment fixes this problem. With Xcode 9.1 the stdio.h in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 seems to become a stub header file with only #include_next <stdio.h> and comments. I think other header files may be the same.

Go to settings.json and change:
C_Cpp.intelliSenseEngine": "Default" to "Tag Parser"

I'm closing old issues marked "more info needed". If you are still having issues with the extension, please ensure you have installed the latest version and open a new issue with the issue details.

If you are having trouble getting system includes to resolve, please remove any system include paths from includePath and set the compilerPath property in c_cpp_properties.json instead.

Was this page helpful?
0 / 5 - 0 ratings