I'm getting `e: Could not find 'main' in '<root...
# kotlin-native
z
I'm getting
e: Could not find 'main' in '<root>' package.
when trying to build either of the modules in my project. I've set up the gradle config like this
Copy code
linuxX64("native") {
    binaries {
        executable("prism")
    }
}
l
Where is your main method? If it is in a package, you need to set the
entryPoint
for the executable.
i.e. If you have main in com/example/foo/Main.kt, the entry point is com.example.foo.MainKt.main
z
I've just placed the main method in the root package in a file named Main
nativeMain/src/kotlin/Main.kt
a
do you declare a package at the top of Main.kt?
l
Shouldn't it be src/nativeMain/kotlin?
z
Oh yeah, that's what I meant.
my main method is in src/nativeMain/kotlin/Main.kt
No package is declared at the top of the file
l
What does the declaration for your main function look like?
z
just
Copy code
fun main(args: Array<String>)
l
Do you need the args? I wonder if it will work if you remove them?
z
I do for cli
If i rename nativeMain to commonMain then it works, but im not sure why it doesnt work in nativeMain
614 Views