larush's blog

By larush, history, 12 months ago, In English

Hi

I have recently been facing some error messages in my IDE (Visual Studio Code), and an error always pops up displaying "cin is ambiguous". I tried to look online but only found some discussions on version control, and could not resolve it. Could some kind person please assist me with this? Many Thanks!

  • Vote: I like it
  • +37
  • Vote: I do not like it

»
12 months ago, # |
  Vote: I like it +3 Vote: I do not like it

You just need to specify the scope of 'cin' , 'cout' , etc. as i'm also facing the same issue... By using this,

std::cin>>tt;

You'll be able to resolve the issue.

»
12 months ago, # |
Rev. 2   Vote: I like it +27 Vote: I do not like it

So, it does seem like this error should not be happening. However, I searched it up, and it seems as if it was a problem in VS Code 2017. If you use VS2019 instead of VS2017, it might work. If that doesn't work, go to this website: https://learn.microsoft.com/en-us/answers/questions/208835/cin-cout-and-other-functins-becomes-ambiguous-in-v It gives this answer: "When this happens, have you tried rescanning the solution rather than closing and reopening the file?

Rescan should be found under the Project menu, and also on the popup menu when you right-click on the source window in the IDE.

Sometimes the database used by Intellisense doesn't get updated automatically and promptly after some changes in the source. A Rescan forces that to happen."

If this doesn't work either, I'm not sure what you can do.

»
12 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Facing this issue as well seems like its some bug in the latest release discussion

»
12 months ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

I was facing the same issue. One work workaround I found for this was to go to VS Code Settings (Ctrl + ,) and then search for "Error Squiggles", select "enabledIfIncludesResolve" and then restart your VS Code.

Attaching a Screenshot here as well: https://imgur.com/kZKT0mz

»
12 months ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

if you have c/c++ extension try installing 1.15.4 version by right clicking on extension and select install another version hope it helps for more reference- https://github.com/microsoft/vscode-cpptools/issues/11122#issuecomment-1604628221

»
12 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I though maybe my c++ compiler might not be installed properly, didn't expected it to be a bug in vscode instead lol

»
12 months ago, # |
  Vote: I like it -18 Vote: I do not like it

Install Sublime Text

»
12 months ago, # |
  Vote: I like it +3 Vote: I do not like it

Restart the vs code

  • »
    »
    12 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I have had this error multiple times and this always works for me

»
12 months ago, # |
  Vote: I like it +8 Vote: I do not like it

I still get this bug sometimes; often, deleting the line #include <bits/stdc++.h>, leaving it for a while, then adding it back in solves the problem.

»
12 months ago, # |
  Vote: I like it 0 Vote: I do not like it

still facing same issue. Any update about this bug ???

»
12 months ago, # |
  Vote: I like it +5 Vote: I do not like it

Include Header file #include<istream> and #include<fstream>

»
12 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Just Reload/Restart VS CODE. The C++ Extension Couldn't Properly Load That's why you are facing this problem.

I was having same problem. Extension was recommending that I should reload. I just reloaded VS Code and problem got fixed.

»
12 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I am also facing this problem since a few days. I think it's a problem with VS code.

»
12 months ago, # |
  Vote: I like it +8 Vote: I do not like it

ok so I got to the root of why this happens,

  • if you built a file and it gives/has errors then C++ IntelliSense f*cks up and causes this error.

Solutions

  • Restarting the VS Code should solve it as extension reloads

  • Best Solution: You can hover on the {} icon on the bottom right and click Rescan so that the IntelliSense updates again.

    Screenshot showcasing Rescan option

»
11 months ago, # |
  Vote: I like it -30 Vote: I do not like it

I say it again Install Sublime Text

  • »
    »
    11 months ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    Why sublime, why not vscode? I use vs code and for me I think it is one of best ide for development as well as for competitive programming.