I want to compile Qt, the compilation log:
/home/funtik/Programs/clion-2017.3.2/bin/cmake/bin/cmake --build /home/funtik/CLionProjects/untitled/cmake-build-debug --target qtcore -- -j 2
[100%] Generating CMakeFiles/libs/qtcore.klib
Exception in thread "main" java.lang.Error: /home/funtik/Programs/Qt/5.10.0/gcc_64/include/QtCore/qnamespace.h:53:7: error: must use 'struct' tag to refer to type 'QMetaObject'
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:137)
at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.indexDeclarations(Indexer.kt:898)
at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.buildNativeIndexImpl(Indexer.kt:888)
at org.jetbrains.kotlin.native.interop.indexer.NativeIndexKt.buildNativeIndex(NativeIndex.kt:56)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processLib(main.kt:375)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:33)
at org.jetbrains.kotlin.cli.utilities.MainKt.invokeCinterop(main.kt:94)
at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:117)
CMakeFiles/qtcore.dir/build.make:60: ошибка выполнения рецепта для цели «CMakeFiles/libs/qtcore.klib»
make[3]: *** [CMakeFiles/libs/qtcore.klib] Ошибка 1
CMakeFiles/Makefile2:136: ошибка выполнения рецепта для цели «CMakeFiles/qtcore.dir/all»
make[2]: *** [CMakeFiles/qtcore.dir/all] Ошибка 2
CMakeFiles/Makefile2:143: ошибка выполнения рецепта для цели «CMakeFiles/qtcore.dir/rule»
make[1]: *** [CMakeFiles/qtcore.dir/rule] Ошибка 2
Makefile:144: ошибка выполнения рецепта для цели «qtcore»
make: *** [qtcore] Ошибка 2
But in the H-file it, QMetaObject, is declared as a structure

qtCore.def
headers = /home/funtik/Programs/Qt/5.10.0/gcc_64/include/QtCore/qglobal.h qconfig.h qnamespace.h
headerFilter = /home/funtik/Programs/Qt/5.10.0/gcc_64/include/**
headerFilter = /home/funtik/Programs/Qt/5.10.0/gcc_64/include/QtCore/**
compilerOpts.linux = -I/home/funtik/Programs/Qt/5.10.0/gcc_64/include/ -I/home/funtik/Programs/Qt/5.10.0/gcc_64/include/QtCore
linkerOpts.linux = -L/home/funtik/Programs/Qt/5.10.0/gcc_64/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/
Cmake-file
cmake_minimum_required(VERSION 3.8)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/KotlinCMakeModule)
project(untitled Kotlin)
cinterop(
NAME libcurl
DEF_FILE c_intertop/libcurl.def
)
cinterop(
NAME qtcore
DEF_FILE c_intertop/qtCore.def
)
konanc_executable(
NAME HelloWorld
SOURCES hello.kt
)
Qt is C++ library, cinterop is the tool to generate Kotlin definitions for C code. So to consume Qt from Kotlin/Native one needs to create C bindings for Qt, which is quite hard tadk. on it's own.
Most helpful comment
Qt is C++ library, cinterop is the tool to generate Kotlin definitions for C code. So to consume Qt from Kotlin/Native one needs to create C bindings for Qt, which is quite hard tadk. on it's own.