MacOS Catalina 10.15.7, VSCode 1.64.2 (Universal) :I had the intellisense working for my project without problems, but then for whatever reason it has stopped working in some cases:
whenever I assign something to an 'auto variable', for example: auto val = (float)foo;
I'd get intellisense error: int val: explicit type is missing ('int' assumed)C/C++(260)
.
Class enums are not recognised as they should, so I can't use EnumClass::Enum
or get any enum-related autocomplete support.
Those are the most reoccuring problems, but I'd say the intellisense generally doesn't work properly.
I removed everything related to VSCode (using this: How to completely uninstall vscode on mac) and reinstalled with just C/C++ extention enabled and the problem persists. I have other people using the same setup with this project and they don't have this problem. I tried older versions of the extention without success aswell.
Is there anything I could try to get it back to work?
Asked
Active
Viewed 630 times
-1

Viral
- 31
- 4
-
1Have you set `"cppStandard": "c++11"` or newer? – 273K Mar 01 '22 at 14:47
1 Answers
1
The issue seems to be that intellisense is using older c++ version for determining the syntax. The way to fix this is to set to some newer version like c++17
Go to settings in your VSCode and search for Cpp Standard
and from the dropdown select c++17
or any newer version that you use.
In case you follow JSON style settings, then search for following
"C_Cpp.default.cppStandard": "c++17"

Ujjwal Kumar Maharana
- 219
- 1
- 5
-
Thank you! This solves the problem. My projest it c++11 based, so I set it to c++11 and it now works. – Viral Mar 01 '22 at 15:28