Skip to content

__has_include does not search Xcode framework path #10840

Closed as not planned
Closed as not planned

Description

Environment

  • OS and Version: macOS 11.7
  • VS Code Version: 1.77.3
  • C/C++ Extension Version: 1.14.5
  • If using SSH remote, specify OS of remote machine:

Bug Summary and Steps to Reproduce

Bug Summary:

#include <CoreFoundation/CFString.h> works fine. Also #if __has_include(<unistd.h>) works well.
But #if __has_include(<CoreFoundation/CFString.h>) does not.

Steps to reproduce:

  1. Set "cppStandard": "c++17"
  2. Put the code below:
    #if !__has_include(<CoreFoundation/CFString.h>)
    #error CFString.h not found!
    #endif
  3. See error on vscode editor pane.

Expected behavior:

No error shows.

Actual behavior:

VS Code shows the error. But it compiles with Xcode clang++ successfully.

Configuration and Logs

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "macos-clang-x64"
        }
    ],
    "version": 4
}

Diagnostics log:

-------- Diagnostics - 4/19/2023, 5:07:01 PM
Version: 1.14.5
Current Configuration:
{
    "name": "Mac",
    "includePath": [
        "/private/tmp/vscode-issue/**"
    ],
    "defines": [],
    "macFrameworkPath": [
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
    ],
    "compilerPath": "/usr/bin/clang",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "macos-clang-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "${workspaceFolder}/**"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ /private/tmp/vscode-issue/main.cc ]:
    /private/tmp/vscode-issue/main.cc
Translation Unit Configurations:
[ /private/tmp/vscode-issue/main.cc ]:
    Process ID: 34806
    Memory Usage: 70 MB
    Compiler Path: /usr/bin/clang
    Includes:
        /usr/local/include
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/include
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
    Frameworks:
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks
    Standard Version: c++17
    IntelliSense Mode: macos-clang-x64
    Other Flags:
        --clang
        --clang_version=110000
Total Memory Usage: 70 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 26339

Other Extensions

No response

Additional context

example code:

main.cc

#if !__has_include(<iostream>)
#error <iostream> not found
#endif

#if !__has_include(<CoreFoundation/CFString.h>)
#error <CoreFoundation/CFString.h> not found
#endif

#include <iostream>

#include <CoreFoundation/CFString.h>

int main()
{
    std::cout << "CFString Type ID: " << ::CFStringGetTypeID() << std::endl;
    return 0;
}

command:

clang++ -framework CoreFoundation main.cc

Activity

  1. Zingam commented on Apr 19, 2023

    @Zingam

    Frameworks are not very well supported. I have observed various navigation and intellisense issues. I believe there are a few issue reports.

  2. bobbrow commented on Mar 19, 2026

    @bobbrow
    Contributor

    Thank you for the report. We’re closing this as not planned.
    This issue has been inactive for a long time, and we will be unable to investigate and address it in the foreseeable future.

  3. locked and limited conversation to collaborators on May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions