skip to Main Content

From past 1 week I am getting the cin and cout ambiguous error in VS Code.

At first it seems that I have imported more than one namespaces thats why the error is coming so I tried to write the most basic cpp code and still it is showing that cin and cout is ambiguous.

#include<iostream>
using namespace std;
int main(){
    int n;cin>>n;
    cout << n;
}

Even this code is also showing ambiguous error when I am specifying std::cin and std::cout then it is resolved. But it is troublesome to write std:: everytime.
Can someone help?

2

Answers


  1. Remove all the unnecessary extensions ,I just had an extension name c++ coderunner or something which was causing the issue just remove the extensions and let me know if it works otherwise we will work with the formatting of launch.json

    Login or Signup to reply.
  2. Well I am having that same issue, I don’t know what to do. But the fun thing is, mine is showing ambiguous with red error underline, still it is compiling the code

    the reloading the window of you vs code, it works for me

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search