scadge
scadge

Reputation: 9723

Compile files with references to each other in Scala

This is my first day of programming Scala and I need to build a project.

So, let's say I have one file Config.scala, which contains line var BestPage1:BasePage = null and another file BasePage.scala, which contains if(m_Refer != null) m_Refer.mkString(Config.ReferSmallDivisor) else "".

And when I try to compile one of them, I get an error: not found: value Config or error: not found: value BasePage.

So how do I compile them both?

ADDED: file contents

BasePage.scala

Config.scala

Upvotes: 0

Views: 89

Answers (2)

Jatin
Jatin

Reputation: 31734

You have defined Config in package scwikimetric and BasePage.scala in default package.

So either change package declararation in BasePage.scala to package scwikimetric. Or add an import scwikimetric.Config in BasePage.scala.

Upvotes: 0

Nicolas Rinaudo
Nicolas Rinaudo

Reputation: 6168

The reason it's not finding Config is because the Config class doesn't exist.

The scwikimetric.Config class, however, does. Import it and things will go much better, I think.

Upvotes: 0

Related Questions