Weird "is ambiguous" errors

I keep getting weird "is ambiguous" errors in Visual Studio 2012.

They don't seem to be caused by any of the normal reasons, and have completely random fixes or triggers, such as the creation of a new bool.



For example (this is simplified code):

1
2
3
bool first;

cout << "print something" << endl;




Will be fine. Then I add another bool and get a "cout is ambiguous error":

1
2
3
4
bool first;
bool second;

cout << "print something" << endl;




After this, the error can generally be fixed by deleting the second bool, saving, and retyping it, or adding a blank line in between the lines, or some other random way that should have no effect on the code. Sometimes, the only thing that works is hitting ctrl+z until the new line is gone, and retyping it.



So this might then work fine:

1
2
3
4
5
bool first;

bool second;

cout << "print something" << endl;




Since it is an easy fix, it isn't too bad a problem, other than the fact that it is a pain to deal with and sometimes may force me to retype code.

My theory is that it is a problem with Visual Studio's methods of checking for errors before compiling.

If anyone knows what is going on and could tell me how to fix it that would be great! Thanks!

P.S. It doesn't only happen with cout, it also happens with other things like the STL random_shuffle()
Last edited on
If you remove using namespace std; I think it will result in the intellisense parser no longer having a heart attack while parsing your code.
Topic archived. No new replies allowed.