The problem was that VSCode’s preferred compiler didn’t coincide with mine.
However, problem solved.
- Open the C/C++ extension in VSCode
- Click ‘Manage’ (the cog wheel next to uninstall)
- Choose extension settings
- Scroll down to C_cpp > Default: Compiler Path
- Click Edit in settings.json
- Make sure the last line reads as follows:
- “C_Cpp.default.compilerPath”: “C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x86”
- Save
Compiler warning now disappears.