Блог пользователя larush

Автор larush, история, 11 месяцев назад, По-английски

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!

  • Проголосовать: нравится
  • +37
  • Проголосовать: не нравится

»
11 месяцев назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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.

»
11 месяцев назад, # |
Rev. 2   Проголосовать: нравится +27 Проголосовать: не нравится

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.

»
11 месяцев назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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

»
11 месяцев назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

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

»
11 месяцев назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

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

»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
11 месяцев назад, # |
  Проголосовать: нравится -18 Проголосовать: не нравится

Install Sublime Text

»
11 месяцев назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Restart the vs code

  • »
    »
    11 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

»
11 месяцев назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

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.

»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
11 месяцев назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

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

»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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.

»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
11 месяцев назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

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 месяцев назад, # |
  Проголосовать: нравится -30 Проголосовать: не нравится

I say it again Install Sublime Text

  • »
    »
    11 месяцев назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    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.