Scala compilation error

hi, this is the code from scala website, tried to create a program and compile but got this error, please suggest what exactly i am missing.


name := "myproj"

version := "0.1"

scalaVersion := "2.13.0"

import scala.math._

class Circle(radius: Double) {
  import Circle._
  def area: Double = calculateArea(radius)


object Circle {
  private def calculateArea(radius: Double): Double = Pi * pow(radius, 2.0)

  val circle1 = new Circle(7.0)



I’m a layman, so take my suggestion cum grano salis: it looks like you’ re trying to RUN, on IntelliJ, a mere Object Circle, and not an Object extending Scala Application; you should open a Scala Console in sbt, and instantiate the Object.
If you go to the Scala Website, under the Documentation section, you’ll find a lot of Tutorials and Guides.

1 Like

Greetings! I think the issue might be the way the project is organized: SBT requires the folder structure should be src/main/scala but you seem to have src/scala.

What happens when you run SBT from command line?

it works as you said from console.

i will try that