If you make a code change while VsCode is debugging, the intellisense sometimes appears to malfunction with false compile errors. Fastest way to reset or correct it?
I had the problem where the following did not work:
Quitting VSCode
Disabling the C/C++ extension
C/C++ Reset IntelliSense database
C/C++ Rescan Workspace
I discovered that I had a bunch of processes running called cpptools and cpptools-srv. After killing all of them and resetting VSCode, everything started working again.
The command I use to kill them is:
pkill cpptools
Under most circumstances, I do not need to quit VSC after using the pkill command above.
I'm using an older version of VS Code (1.48.1). This answer solved the problem for me of a file not generating C/C++ IntelliSense information. If resetting the IntelliSense is not enough (Ctrl+Shift+P → C/C++: Reset IntelliSense database; it wasn't for me), try this:
Make sure there are no red squiggles (parsing errors) in the file, especially on #include directives. The best way to resolve include problems is to declare more include directories in the workspace. (I saw a lot of answers on how to do it system/user-wide, but only incomplete answers on how to do it per workspace.) Do this by generating a c_cpp_properties.json file in the workspace directory (mine didn't seem to have one already): Ctrl+Shift+P → C/C++: Edit Configurations (JSON). Add paths to includePath, until all include errors go away in the problematic file and in all files that it includes. Use the variable, ${workspaceFolder} to refer to the root directory of the workspace. By the way, mine defaulted to only having ${workspaceFolder}/** in includePath, which should recursively search your entire workspace folder for include files. It did not work for me, at least on one particular file. I had to explicitly add more directories under ${workspaceFolder}, in order for VS Code to find some includes. I didn't have any issue with standard library includes. So, this answer does not address those.
You may need to do another reset of the IntelliSense database and restart VS Code before it starts showing all IntelliSense information properly. I also found that it seemed to help to open the include files that it's looking for to help it find the files. I'm hoping this keeps working for me. So far so good.