I’m using Nsight VS Code Edition 2024.1 along with Microsoft VS Code C/C++ extension version 1.22.11. Lately, I noticed that the parser is acting strangely as if it’s parsing C code instead of C++. Something as simple as below saved as hello.cu
void A(int &B) {
B += 1;
}
yields squiggles at the tokens A and B. The errors are:
at A on the first line: “unnnamed prototyped parameters not allowed when body is present”
at B on first line: “expected a ‘)’”
at B on second line: “identifier “B” is undefined”
These are the exact same errors I get when I change the language mode to C. On the other hand, switching it C++ clears the error for the above, but will yield squiggles on CUDA specific constructs (like <<<).
Downgrading the C/C++ extension to 1.21.6 makes the parsing work as before. It looks like there’s a breaking API change when upgrading to 1.22. Can someone confirm?
Hi Ahmad, I could not repro this on my end. What OS are you on? Is it possible your language is being incorrectly set? Perhaps you have something that overrides extension defaults in your settings.json. Try Ctrl+ Shift + P and changing language mode to CUDA C++
Hi navyaasanan, I’m on Windows 10 22H2 with VS Code 1.90.2 connecting to a Centos 8.2 machine via Remote - SSH. It has CUDA 12.0 installed. The squiggles appear when the language is set to either CUDA C++ or plain C. It disappears when the language is set to plain C++, unless a CUDA language construct is written.
I forgot that I had my VS Code auto-update disabled. I’ve just upgraded VS Code to version 1.96.4 (2025-01-16) and C/C++ extension to 1.22.11, and the error appears again. Downgrading the extension to 1.21.6 again solves the problem as before.
Hi Ahmad, have you ever tried to re-install all related extension or reinstall vscode/vscode-server(remote) As when you install Nsight VSCode Extension, C/C++ extension should be installed as extension pack. I cannot repro this issue also, it is better to use a clean environment to isolated issues.
Thank you yiczhang. Reinstalling vscode-server is as easy as renaming $HOME/.vscode-server to something else. If I install Nsight VSCode Extension first before installing C/C++ extension, I now get C/C++ extension version 1.23.5, which according to Visual Studio Marketplace is indeed the latest version. I don’t know why versions 1.23.1 to 1.23.4 were not available to me (and still is not available, if I choose “Install Specific Version…”) but it doesn’t matter now that the problem is solved :)