Home > Back-end >  Why does kotlin/native hello world not output anything inside IntelliJ IDEA on Apple M1?
Why does kotlin/native hello world not output anything inside IntelliJ IDEA on Apple M1?

Time:11-08

I've downloaded a fresh IntelliJ IDEA with the Kotlin multiplatform plugin and created a project using the Native application project template. This template creates a Main.kt file with the content:

fun main() {
    println("Hello, Kotlin/Native!")
}

As well as many other gradle files referencing kotlin("multiplatform") version "1.7.20". I can build and run the project from inside IntelliJ IDEA, but I see no hello world:

no hello world

I can only see the gradle output and a success result, but no Hello Kotlin/Native! message anywhere. I've tried changing the runDebugExecutableNative settings and checked the options related to show the console/output when stdout messages are printed:

project settings

I can see no other output window/pane, so… where can I see the output? The project builds a debug or release Kasha.kexe which I can run from the command line manually, but I'm guessing an IDE shouldn't require me to run commands from the command line every time?

$ ./build/bin/native/debugExecutable/Kasha.kexe
Hello, Kotlin/Native!

I can see a greyed out symbol in the run pane, which corresponds to the output > Task :runDebugExecutableNative SKIPPED. Does that mean the IDE can only build but not run the executable? I'm using IntelliJ IDEA 2022.2.3 (Community Edition) and kotlin("multiplatform") version "1.7.20".

UPDATE As enter image description here

You should not add another entry for macosX64 unless you really want to, then you have to remove the dependsOn dependency

u'll got:

enter image description here

  • Related