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#

Andrew Miller
Andrew Miller
14,295 Points

Compiling Error

Hi I am a bit stuck on this error and I reviewed the code and the past videos, but still not seeing where the issue. I am wondering if the issue is not within Exceptions.cs but within either Game.cs or Path.cs so I am including the code for that too.

I am getting the following errors: Exceptions.cs(16:14): Class, struct, or interface method must have a return type Exceptions.cs(20:14) Class, struct, or interface method must have a return type

Link to the snapshot: https://w.trhou.se/ovvotsqaf8

Steven Parker
Steven Parker
231,110 Points

Use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:   Or watch this video on code formatting.

Even better, make a snapshot of your workspace and post the link to it here. That shares the entire project at once at makes it far easier to analyze an issue.

Andrew Miller
Andrew Miller
14,295 Points

Thanks Steven Parker I did not know that I could just do the snapshot. That is a better way to share in this case. I updated my question to include the link to the snapshot instead of pasting the code.

2 Answers

Steven Parker
Steven Parker
231,110 Points

It looks like you're creating constructors, but constructors must have the same name as the class or the system will treat them as methods (which require a return type).

The class is named "OutofBoundsException" (with a lower-case "o"), but these "consructors" are named "OutOfBoundsException" (with a capital "O").

Andrew Miller
Andrew Miller
14,295 Points

Steven Parker Thanks! Totally missed that! I knew it was going to be something simple.