Giter Club home page Giter Club logo

Comments (10)

sean-mcmanus avatar sean-mcmanus commented on September 27, 2024

@Unturned3 I don't repro the issue with the latest Apple clang (you're using the newer LLVM non-Apple clang though). Can you run the C/C++: Log Diagnostics command after opening the source file?

from vscode-cpptools.

Unturned3 avatar Unturned3 commented on September 27, 2024

Hmm.. strange. I replaced /usr/local/opt/llvm/bin/clang with /usr/bin/clang for compilerPath (i.e. to use Apple's clang), and the issue disappeared. Why does this happen with Homebrew's latest clang though? What does that error message even mean?

Anyways, here's the C/C++: Log Diagonistics output:

-------- Diagnostics - 5/3/2024, 11:53:05 PM
Version: 1.20.4
Current Configuration:
{
    "name": "Mac",
    "includePath": [
        "/Users/richard/Desktop/T2/**"
    ],
    "macFrameworkPath": [
        "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
    ],
    "compilerPath": "/usr/local/opt/llvm/bin/clang",
    "cppStandard": "c++17",
    "intelliSenseMode": "macos-clang-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/local/opt/llvm/bin/clang",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "/Users/richard/Desktop/T2/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.20.4.0
No active translation units.

from vscode-cpptools.

sean-mcmanus avatar sean-mcmanus commented on September 27, 2024

@Unturned3 I'm not sure. I know a similar error can occur if c++03 is used. Are you able to compile/link? Have you tried changing it to /usr/local/opt/llvm/bin/clang++? If you use go to def on either the <vector> or std::vector and looked for the constructor taking an initializer list it might show as disabled due to some defines.

from vscode-cpptools.

Unturned3 avatar Unturned3 commented on September 27, 2024

Yes, I am able to compile & link with the Homebrew clang just fine. No errors/warnings. I tried setting the compilerPath to /usr/local/opt/llvm/bin/clang++ but the error persisted. I did check the <vector> header, but unfortunately my C++ knowledge is nowhere good enough for me to understand the mess in there.

from vscode-cpptools.

MinetaS avatar MinetaS commented on September 27, 2024

This happens on Windows with msys clang 18.1.3 as well. Apparently, the error appears only when <initializer_list> is included before <vector>. Including <initializer_list> after <vector> does not have the problem.

To reproduce, create an empty workspace and write a simple C++ code:

// The error only appears if initializer_list is included before vector
#include <initializer_list>
#include <vector>

int main() {
    std::vector<int> v{1, 2, 3};
    return 0;
}

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "C:\\\\msys64\\\\clang64\\\\bin\\\\x86_64-w64-mingw32-clang++.exe",
            "intelliSenseMode": "windows-clang-x64",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "compilerArgs": [
                "--std=c++17"
            ]
        }
    ],
    "version": 4
}

C/C++: Log Diagnostics:

-------- Diagnostics - 5/6/2024, 2:48:50 AM
Version: 1.20.4
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Users/skdty/repos/test/**"
    ],
    "defines": [],
    "compilerPath": "C:\\\\msys64\\\\clang64\\\\bin\\\\x86_64-w64-mingw32-clang++.exe",
    "intelliSenseMode": "windows-clang-x64",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "compilerArgs": [
        "--std=c++17"
    ],
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "C:\\\\msys64\\\\clang64\\\\bin\\\\x86_64-w64-mingw32-clang++.exe",
    "windowsSdkVersion": "10.0.22621.0",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "c:/Users/skdty/repos/test/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.20.4.0
Translation Unit Mappings:
[ C:\Users\skdty\repos\test\test.cc - source TU]:
Translation Unit Configurations:
[ C:\Users\skdty\repos\test\test.cc ]:
    Process ID: 20808
    Memory Usage: 206 MB
    Compiler Path: C:\msys64\clang64\bin\x86_64-w64-mingw32-clang++.exe
    Includes:
        C:\msys64\clang64\include\c++\v1
        C:\msys64\clang64\lib\clang\18\include
        C:\msys64\clang64\include
    Standard Version: c++17
    IntelliSense Mode: windows-clang-x64
    Other Flags:
        --clang
        --clang_version=180103
Total Memory Usage: 206 MB

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

from vscode-cpptools.

browntarik avatar browntarik commented on September 27, 2024

@Unturned3 @MinetaS Does the issue persist when changing your IntelliSense Mode to *-clang-x86?

from vscode-cpptools.

MinetaS avatar MinetaS commented on September 27, 2024

@browntarik Yes, for windows-clang-x86 the issue persists. Along with the compiler path set to C:\msys64\clang32\bin\i686-w64-mingw32-clang++.exe.

from vscode-cpptools.

SomedudeX avatar SomedudeX commented on September 27, 2024

I also have the same issue after updating my homebrew clangd to 18.1.6. Perhaps the cpptools extension does not recognize the updated header files, and treated/parsed the initializer list class as a normal class as opposed to a language supported and defined standard, which ultimately resulted in it not being able to find a suitable constructor?

Either way I really hope this gets updated/fixed soon by the teamβ„’

from vscode-cpptools.

browntarik avatar browntarik commented on September 27, 2024

@MinetaS I am having trouble installing your compiler with a version of 18.x, could you walk me through some steps on how to acquire your compiler?

We are currently out of date with the version numbers of compilers that our IntelliSense supports, and those numbers will be updated but being able to get a clang compiler with the correct version will help with testing.

from vscode-cpptools.

MinetaS avatar MinetaS commented on September 27, 2024

@browntarik Sorry for the late response. Somehow I unsubscribed this issue by mistake.

It's the official clang/llvm package from msys2. https://packages.msys2.org/package/mingw-w64-x86_64-clang

pacman -S mingw-w64-x86_64-clang

in msys2 terminal will install it. The compiler path is mentioned in my previous comment above.

from vscode-cpptools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.