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.

Pandora Access Error

Getting an Access Error randomly through your Receiver when attempting to access Pandora and it won’t go away?  Or how about “We’re sorry, but we can’t find any more music to play on your station right now. Try switching stations” through your desktop browser?

Try creating a new Pandora account!

I’ve been plagued with this error at intermittent times over the past couple of years through my Yamaha RX-V675 receiver so this morning I had some time of my hands to troubleshoot the problem.

The web is full of suggestions to try and I think the best one came from a Yamaha support rep who suggested purchasing an Apple Airport Express in place of the wireless router one particular person was using in order to resolve the issue.  Though apparently this resolved it for this person, I don’t think it is a fault with the equipment but more an issue with Pandora itself.

You will unfortunately have to re-do your created stations as well as your likes/dislikes but it should at least get you reconnected in the meantime.

So did it work for you too?

Console Colours C++ header file

About a year ago, I started writing a little database program for the console  (just a simple little thing to modify, add, and subtract items from a SQL-Lite database) and I wanted it to be colourful.  However, the codes aren’t that much fun to type in so I came up with a crude implementation of something that could create a header file for me to handle exactly that.

It wasn’t pretty, and a year on with a little extra C++ knowledge under my belt I came up with this to replace it.

This creates a header file and also a nice output listing to print out.

Edit: I’ve since given it a third revision that outputs the codes to a console window rather than to an output file, which kind of made a bit more sense.  I can copy/paste it to a future post if someone wants it.

// Program to output a definition header file for Windows Console colours

#include "stdafx.h"
#include 
#include 
#include 
#include 

using namespace std;

int main()
{
	/* Output Header file */
	ofstream outFile;
	outFile.open("ConsoleColours.h");
	outFile << "#ifndef ConsoleColoursH" << endl;
	outFile << "#define ConsoleColoursH" << endl;
	outFile << " " << endl;
 
	/* Output Nice Listing */
	ofstream niceList;
	niceList.open("ConsoleColours-Nice.txt");
 
	string listColours[16] = { "DARK_BLUE", "GREEN", "TEAL", "RED",
		"PINK", "KHAKI", "WHITE", "GREY",
		"BRIGHT_BLUE", "BRIGHT_GREEN", "BRIGHT_TEAL", "BRIGHT_RED",
		"BRIGHT_PINK", "BRIGHT_YELLOW", "BRIGHT_WHITE", "BLACK" };
 
	for (int i = 0; i < 256; i++)
	{
		for (int j = 0; j < 16; j++)
		{
			for (int k = 0; k < 16; k++)
			{
				// Output to console window
				if (k % 16 == 0) cout << endl;
 
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), i); cout << " " << i << " ";
 
				//  Output to header file
				outFile << "#define " << listColours[j] << "_WITH_" << listColours[k] << "_BACKGROUND" " SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), " << i << ");" << endl;
 
				// Create a nice title for each colour in our textfile
				if (k % 16 == 0)
				{
					niceList << endl << listColours[j] << endl;
					niceList << string(listColours[j].length(), '=') << endl;
				}
				// Output to nice listing
				niceList << listColours[j] << "_WITH_" << listColours[k] << "_BACKGROUND" << endl;
				i++;
				if (i == 255) SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 8);
			}
		}
	}
	outFile << " " << endl; outFile << "#endif" << endl; outFile.close();
 
	// Reset Console to normal
	cout << endl << endl;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
 
	return 0;
}