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#

Ashenafi Ashebo
Ashenafi Ashebo
15,021 Points

error cs2008

I am getting this error:

error CS2008: No files to compile were specified Compilation failed: 1 error(s), 0 warnings

these are the codes

using System; namespace TreehouseDefense { class Point

{ public readonly int X; public readonly int Y;

  public Point(int x, int y)
  {

    X = x;
    Y = y;

  }

 public int DistanceTo(int x, int y)

 {
   int xDiff = X-x;
   int yDiff = Y-y;

   int xDiffSquared = xDiff * xDiff;
   int yDiffSquared = yDiff * yDiff;

   return (int)Math.sqrt(xDiffSquared + yDiffSquared);

 }

}

}

using System; namespace TreehouseDefense { class Game { public static void Main() { Map map = new Map(8,5);

      Point point = new Point(4,2);

      Console.WriteLine(point.DistanceTo(5, 5));

    }
}

}

1 Answer

Steven Parker
Steven Parker
231,184 Points

What command did you give to compile the code?

You didn't provide a link to the course page, but I would guess that the proper command to compile is likely:

mcs -out:TreehouseDefense.exe *.cs

In future (or if this doesn't solve your issue), to enable a thorough analysis of a situation involving multiple sources, make a snapshot of your workspace and post the link to it here, along with a link to the course page you are working with.