Cout is ambiguous?

What does that mean? How do I fix it?
Post the actual error message, as well as the line of code which is causing the error.
Post your code so that it is [code]between code tags[/code] as this will give it syntax highlighting and line numbers.

Please copy and paste the exact error message, and indicate which line the error is talking about.
Last edited on
Well, I am working on this bank database project and whenever I post this part:

void addaccount()
{
ifstream inData;
ofstream outData;
string fileName;
string str;
cout << "Insert the name of the data file: ";
cin >> fileName;
inData.open(fileName); // Access the file of the name you had inputted
string lastName, firstName, type;
double balance;
inData >> lastName >> firstName >> balance >> type;
cout << "What file would you like to save the data in?: ";
cin >> fileName;
outData.open(fileName);
outData << str;
cout << "\nEnter the customer's last name:";
cin >> lastName;
cout << "\n\nEnter the customer's first name : ";
cin >> firstName;
cin.ignore();
cin.getline(50, firstName);
cout << "\nEnter Type of The account (C/S) : ";
cin >> type;
type = toupper(type);
cout << "\nEnter The Initial amount(>=500 for Saving and >=1000 for current ) : ";
cin >> deposit;
cout << "\n\n\nAccount Created.";
}

void deleteaccount();
{
account ac;
ifstream inFile;
ofstream outFile;
inFile.open("account.dat", ios::binary);
if (!inFile)
{
cout << "File could not be open !! Press any Key...";
return;
}
outFile.open("Temp.dat", ios::binary);
inFile.seekg(0, ios::beg);
while (inFile.read(reinterpret_cast<char *> (&ac), sizeof(account)))
{
if (ac.retacno() != n)
{
outFile.write(reinterpret_cast<char *> (&ac), sizeof(account));
}
}
inFile.close();
outFile.close();
remove("account.txt");
rename("Temp.txt", "account.txt");
cout << "\n\n\tRecord Deleted ..";
}

void search();
{
int seqSearch(const int list[], int listLength, int searchItem)
{
int loc;
bool found = false;

for (loc = 0; loc < listLength; loc++)
if (list[loc] == searchItem)
{
found = true;
break;
}
if (found)
return loc;
else
return -1;
}

into it, all the couts get the error message IntelliSense: "cout" is ambiguous.
Speaking of which, I really need help with that. I have a topic called 'Bank Database' I could really use help with.
IntelliSense errors aren't compilation errors. Sometimes IntelliSense can get confused or out of date.

Go to Build -> Rebuild
You may also consider trying to prefix your 'cout' object with its namespace, 'std'. In other words, wherever you've put

cout << "Information";

You may consider putting

std::cout << "Information";

Perhaps there are multiple objects called 'cout' in your program (or you've included external libraries which also have a cout object) and providing a namespace might give some clarification as to which one you mean.
Topic archived. No new replies allowed.