Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Unresolved reference: main #135

Open
shalva97 opened this issue May 3, 2021 · 0 comments
Open

Unresolved reference: main #135

shalva97 opened this issue May 3, 2021 · 0 comments

Comments

@shalva97
Copy link

shalva97 commented May 3, 2021

hello, decided to do some kotlin native and found this hands-on/Introduction to Kotlin Native/04_AddingInteropToBuild.md

there it says to add some newlines to generate some header files. but I get errors:

e: /home/shalva/intellijProjects/IdeaProjects/untitled/build.gradle.kts:26:22: Unresolved reference: main
e: /home/shalva/intellijProjects/IdeaProjects/untitled/build.gradle.kts:27:13: Unresolved reference: cinterops
e: /home/shalva/intellijProjects/IdeaProjects/untitled/build.gradle.kts:28:17: Unresolved reference: libcurl

Build file '/home/shalva/intellijProjects/IdeaProjects/untitled/build.gradle.kts' line: 26

Script compilation errors:

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

my build file is auto generated from intellij:

plugins {
    kotlin("multiplatform") version "1.5.0-RC"
}

group = "me.shalva.firsplugin"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}



kotlin {
    val hostOs = System.getProperty("os.name")
    val isMingwX64 = hostOs.startsWith("Windows")
    val nativeTarget = when {
        hostOs == "Mac OS X" -> macosX64("native")
        hostOs == "Linux" -> linuxX64("native")
        isMingwX64 -> mingwX64("native")
        else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
    }

    nativeTarget.apply {

        compilations.main { // NL
            cinterops {     // NL
                libcurl     // NL
            }               // NL
        }

        binaries {
            executable {
                entryPoint = "main"
            }
        }
    }
    sourceSets {
        val nativeMain by getting
        val nativeTest by getting
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant