File ./Main.kt:
import numbers
fun main() {
var value = numbers.sum(7, 4)
}
File ./numbers/Operations.kt:
package numbers
fun sum(val1: Int, val2: Int): Int {
return val1 + val2
}
Running the command kotlinc Main.kt outputs:
Main.kt:1:8: error: unresolved reference: numbers
import numbers
Main.kt:4:17: error: unresolved reference: numbers
var value = numbers.sum(2, 3)
If I try to add import java (I am new in Kotlin ans I saw someone imported this. I thought it is a part of a standard library) then output also contains:
Main.kt:1:8: error: packages cannot be imported
import java
What I did wrong?
SOLUTION (Thanks to @gidds):
Was need to pass each file to the complier, not like with Java compiler (javac)
kotlinc Main.kt numbers/Operations.kt