Comments (10)
@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.
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.
@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.
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.
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.
@Unturned3 @MinetaS Does the issue persist when changing your IntelliSense Mode to *-clang-x86?
from vscode-cpptools.
@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.
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.
@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.
@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)
- Incorrect IntelliSense Error on SSH remote: identifier "Point" is undefined HOT 13
- Add Invalid Setting Warnings to Setting Validation Logic
- Notification of breaking api change with v1.92 release of VS Code HOT 2
- C:\MinGW\bin
- Incorrect Doxygen comments generated HOT 4
- Language server crashing HOT 12
- C++ language services support for Copilot Chat Code Blocks HOT 2
- File with non-standard extension causes editor's Language Mode to keep reverting back to C HOT 2
- Add LLDB and MIEngine hardware breakpoint support
- cannot resolve namespace llvm on macos VS code HOT 1
- Missing all text on extension readme image HOT 1
- The debugger doesn't hit the breakpoints set in Editor
- could not be opened because the file was not found HOT 13
- cpptools 1.21.x sometimes crashes repeatedly in modules_cleanup HOT 2
- Find All References may fail to find references after a rename
- GCC stack usage HOT 1
- "IntelliSense engine" has affected the navigation bar's analysis of the code segments, only allowing the display of the outermost code segments. HOT 1
- Failing to run with Fish shell
- Change outlining/regions to collapse function arguments (so the last argument isn't pinned in the sticky scroll feature) HOT 1
- IntelliSense error: could not find module file for module HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-cpptools.