Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Objects Methods Return Values

Sandra Gury
Sandra Gury
6,911 Points

Errors, namepaces not found

Here is a snapshot of my work: https://w.trhou.se/mvb18tgqxy

I don't understand because I did exactly like the teacher but I got those error messages:

Game.cs(9,11): error CS0246: The type or namespace name Map' could not be found. Are you missingTreehouseDefence' using directive?
Game.cs(11,11): error CS0246: The type or namespace name Point' could not be found. Are you missingTreehouseDefence' using directive?
Game.cs(12,26): error CS0841: A local variable map' cannot be used before it is declared Game.cs(15,23): error CS0246: The type or namespace namePoint' could not be found. Are you missing TreehouseDefence' using directive? Game.cs(15,11): error CS0841: A local variablepoint' cannot be used before it is declared
Game.cs(16,21): error CS0841: A local variable map' cannot be used before it is declared Map.cs(16,13): error CS0103: The nameinBounds' does not exist in the current context

1 Answer

It looks like you just have a typo when declaring your namespaces.

For example, in your Game.cs file the Game class is in the "TreehouseDefense" namespace while in your other files the namespace is "TreehouseDefence".

I believe that should solve all of your errors but let me know if it doesn't.

cheers