VSCode C/C++ IntelliSense / Go-To-Definition Issues

Visual Studio Code is a pretty good at inferring the structure of C/C++ projects and automatically building accurate symbol tables and resolving references. Every once in a while, especially when I’m using VSCode remotely using SSH, the IntelliSense processes go haywire and all definitions become difficult to resolve.

There is some intersection between upgrading the version of the C/C++ Extension and doing remote development that breaks things. The ‘C/C++: Reset IntelliSense Database’ command from the Command Palette is not helpful here.

To see if this issue is affecting you, run

ps aux | grep -i cpptools

and see if you have more than ~2 processes running, especially with different versions (ms-vscode.cpptools-1.2.2 and ms-vscode.cpptools-1.2.1 for example).

To fix the issue, just kill the extraneous processes (killall cpptools), and then uninstall/reinstall the C/C++ extension on the remote.