Error: “cout” is ambiguous

Capture21

The problem here should stick out like a sore thumb and on this occasion I saw the cause of the red squiggly lines under the cout’s straight away. There’s a curly brace missing after my else statement (accidentally deleted).

So why am I writing this if it’s that simple?  Because it’s caught me out before sometime ago and at the time I couldn’t see where the problem was.  Scouring the web returned all sorts of suggestions including a lack of particular library includes (such as iostream, stdlib), or not using the std namespace which in some circumstances may do the trick.

However, often it’s the simple oblivious things that catch us out and it surprised me while researching this error for this post, how many examples of uploaded code with a brace missing there are that are being overlooked by the best of us.

I guess the rule of thumb is;  check the little things.

Leave a Reply

Your email address will not be published. Required fields are marked *