Avatar ·

Kotlin: Unresolved reference error in IntelliJ IDEA — what to do?

Hello everyone! I just started learning Kotlin and ran into a problem. I'm writing simple code in IntelliJ IDEA Community Edition, but the IDE gives the error "Unresolved reference: println" and "Unresolved reference: main". Here's my code: ```kotlin fun main() { println("Hello, World!") } ``` I created a new Kotlin/JVM project, checked "Gradle" and "Kotlin DSL". The file is named Main.kt, located in src/main/kotlin. But the IDE underlines both println and main in red. When trying to run the project via the green arrow — the button is inactive. Gradle syncs, but the error remains. I tried recreating the project, clearing the cache (File -> Invalidate Caches), reinstalling the Kotlin plugin — it didn't help. The Kotlin version in build.gradle.kts is set to 1.9.0, IntelliJ IDEA is updated to the latest version 2024.1. What am I doing wrong? Maybe I need to configure something additional in the project configuration? I would be grateful for any help! <<>>

Main reason: incorrect SDK or module configuration