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 trialAlexis Ruiz
9,237 PointsThe type or namespace name `Tower' could not be found. Are you missing `TreeHouseDefense' using directive?
Why do I get these errors?
Game.cs(7,11): error CS0246: The type or namespace name Tower' could not be found. Are you missing
TreeHouseDefense' using
directive?
Game.cs(8,11): error CS0246: The type or namespace name Map' could not be found. Are you missing
TreeHouseDefense' using di
rective?
Game.cs(10,11): error CS0841: A local variable map' cannot be used before it is declared
Game.cs(11,11): error CS0841: A local variable
map' cannot be used before it is declared
Game.cs(13,22): error CS0841: A local variable `map' cannot be used before it is declared
I created the classes without any typo IMO. For example, this is my Map class:
namespace TreeHouseDefense { class Map { public int Width; private int Height; }
}
So what's the problem :(?
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! According to the video, the namespace should be TreehouseDefense
, but you have posted here a namespace of TreeHouseDefense
. I feel like the problem is a typo in the namespace regarding the capitalization of the "H" versus "h". Try correcting that and see if you get some different results. Otherwise, we'll likely need to see a snapshot of your workspace.
Hope this helps!
Alexis Ruiz
9,237 PointsAlexis Ruiz
9,237 PointsThank you very much, it solved the problem.