I was setting up VS Code to program in c++, but quickly confronted the problem: identifier "cout" is undefined
.
#include<iostream>
using namespace std;
int main() {
cout << 1; // identifier "cout" is undefined C/C++(20)
return 0;
}
But I ctrl + click cout
, it successfully goto iostream
library.
When modified as follows, it got namespace "std" has no member "cout"
:
#include<iostream>
int main() {
std::cout << 1; // namespace "std" has no member "cout" C/C++(135)
return 0;
}
By the way, the problem occurred after I reinstalled the system. There wasn't such problem before. All the settings are synchronized via my account.
Additional screenshots: