Forum > Mood Light Error!

I received your book today (May 13th 2008). Unfortunately I had to wait until I was off of work before my delve.
I'm interested in making video games and I can't wait until I'm a pro. (Lots of practice padowan)
I was working on the mood light (Chapter 2) and I encountered a problem.
When trying to build I receive the error: Error 'Game1': member names cannot be the same as their enclosing type.

and it refers to the title of my class.
I followed the book as best as I could and yet I still can't figure it out. I looked up the error and that wasn't much help.
I know somehow I used the name twice but being a beginner I can't figure this out.
After I post this I'm going to look at your code and see if I can figure it out.
Thanks in advance.

(Great book btw definitely worth every cent)

May 14, 2008 | Unregistered CommenterPortzMonkey

Any luck figuring it out?

Maybe you can post some code in a pastebin and link it to us. That way maybe we can help you if you have not figured it out yet.

Shawn

PS - Here is a link to a pastebin you can throw code into, rather than posting the code in the reply:

PASTEBIN

May 18, 2008 | Unregistered CommenterShawn

Hi. Glad you like the book. This is usually becuase you put something in a class with the same name as the class:


class Fred
{
int Fred;
}

Make sure you have not inadvertantly put something called Game1 inside Game1, or copied some sample code inside some sample code:


class Game1
{
class Game1
{
}
}

I think I'll set up a "Bring out your dead" dropbox where you can put broken code for me to take a look at. I can't promise to fix (or even understand) everything, but I'll do my best.

May 27, 2008 | Registered CommenterRob