Patrick
04/20/2020, 2:40 PMpackage sample
import io.ktor.client.HttpClient
import io.ktor.client.engine.curl.Curl
import io.ktor.client.features.json.JsonFeature
import io.ktor.client.features.json.serializer.KotlinxSerializer
import io.ktor.client.request.get
import kotlinx.coroutines.runBlocking
fun main() = runBlocking<Unit> {
    val client = HttpClient(Curl) {
        install(JsonFeature) {
            serializer = KotlinxSerializer()
        }
    }
    val response = client.get<String>("<http://google.de>")
    println(response)
}
However the linker fails with this error message: C:\Users\Patrick\.konan\dependencies\msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1\bin\ld: cannot find -lcurl - This tells me that curl seems to be missing. However it should be installed on Windows 10 by default. I also downloaded the curl binaries and added them to the include path, but still nothing. Any ideas why the linker fails here?Patrick
04/20/2020, 2:41 PMplugins {
    kotlin("multiplatform") version ("1.3.72")
}
repositories {
    mavenCentral()
    jcenter()
}
kotlin {
    val ktorVersion = "1.3.2"
    // For ARM, should be changed to iosArm32 or iosArm64
    // For Linux, should be changed to e.g. linuxX64
    // For MacOS, should be changed to e.g. macosX64
    // For Windows, should be changed to e.g. mingwX64
    mingwX64("mingw") {
        binaries {
            executable {
                entryPoint("sample.main")
            }
        }
    }
    sourceSets {
        commonMain {
            dependencies {
                implementation(kotlin("stdlib-common"))
                implementation("io.ktor:ktor-client-core:$ktorVersion")
                implementation("io.ktor:ktor-client-curl:$ktorVersion")
                implementation("io.ktor:ktor-client-serialization-native:$ktorVersion")
                implementation("io.ktor:ktor-client-json-native:$ktorVersion")
            }
        }
        commonTest {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
            }
        }
        mingwX64().compilations["main"].defaultSourceSet {
            dependencies {
            }
        }
        mingwX64().compilations["test"].defaultSourceSet {
        }
    }
}Artyom Degtyarev [JB]
04/20/2020, 3:25 PMPatrick
04/20/2020, 3:29 PM