Sometimes soruce file cannot be found even cmake tool can build the project successfully, this is because an incorrect configuration provider is set, we can fix it by F1
and
>C++: Change Configuration Provider
and choose cmake tool
. Which essentially modifies .vscode/settings.json
and sets
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"