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 trialDaniel Irchai
7,260 PointsCompiler Errors in Invader Class and Missing Source File
I recently finished the C# Objects course, following along with every video in my own workspace. I've basically copied exactly what the guy was doing (aside from giving variables different names, just to add my own flare). However, I've encountered several compiler errors that were not shown in the videos. Here's a snapshot of my workspace:
There are four errors pertaining to the Invader file, and two that state that a "source file" could not be found. What do they mean? If you know a fix for this, I'd like if the snapshot were forked and shown to me. Thanks!
1 Answer
Steven Parker
231,172 PointsThe "source files" are the files that make up your project, like 'Map.cs" and "Path.cs".
You might be getting some of these errors from changing some of the names but not changing it every place that it is referenced. For example, in Location.cs you have a reference on line 9 to "Maplocation", but now you no longer have that name defined in your project.
I cleared up the errors in Invader.cs (missing semicolon on line 10, "invader" misspelled on line 11), but that just revealed more compiler errors. Fixing them all might be a big job.
My recommendation is to download the project files and use the final version files (stage 4/video 5). Then, starting with those, make your changes one at a time, and make sure the project still compiles after each change. That will make it much easier to find overlooked reference mismatches.
Daniel Irchai
7,260 PointsDaniel Irchai
7,260 PointsI was also able to fix those errors in Invader.cs and that removed all those compiler errors for me. The only one I have left is error CS2001, stating that "Source file '.cs' could not be found". Is there any way to fix that problem without the project files? Besides, I don't even think I have the right program to use them.
Steven Parker
231,172 PointsSteven Parker
231,172 PointsThat doesn't seem like an actual file name, there should be something in front of the period. What was the actual command you gave that returned that error?