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 Inheritance Throwing Exceptions

error CS0246: The type or namespace name 'MapLocation' could not be found.

class Game { public static void Main() {

      Map map = new Map(8,5);

      try
      {
        MapLocation mapLocation = new MapLocaion(20,20,map);
      }

      catch(Exception ex)
      {
        Console.WriteLine(ex.Message);
      }

    }
}
Steven Parker
Steven Parker
231,271 Points

To analyze directory issues it would be necessary to see your complete environment. You can make a snapshot of your workspace and post the link to it here.

Also, what command to you give to compile?

https://w.trhou.se/4h3tknocny

this is the link please find the problem. I searched google and it says directory issue. but everything i did was identical to what speaker did in the video.

1 Answer

Steven Parker
Steven Parker
231,271 Points

Running the workspace, I got a slightly different error: "Game.cs(14,43): error CS0246: The type or namespace name `MapLocaion' could not be found." The difference, and the clue, is the missing "t".

So in Game.cs on line 14 (at column 43) there is "MapLocaion" instead of "MapLocation". After fixing that it will compile (but with a warning because there is more code to be added yet).