Anyone got this problem already? ```> Task :lin...
# kotlin-native
r
Anyone got this problem already?
Copy code
> Task :linkTestDebugExecutableIosSim
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_UIDevice", referenced from:
      objc-class-ref in combined.o
ld: symbol(s) not found for architecture x86_64
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors
Occurred after adding some imports for
platform.UIKit.<stuff>
in a file
r
Yeah this looks like the same issue but I don’t see any solution. The imports are defined in the main sources and the compilation fails for the test sources, but the test sources are not using the file containing these imports
@svyatoslav.scherbina is this how it’s supposed to work?
s
Are these imports required? If no, then the solution is to remove them. If yes, then it is not the same issue.
r
@svyatoslav.scherbina they are, they’re used in the main sources. But why does it fail to compile the test debug executable? The test sources don’t have UIKit imports and don’t use the main file which contains the import
s
But why does it fail to compile the test debug executable? The test sources don’t have UIKit imports and don’t use the main file which contains the import
Because test debug executable contains compiled main sources.
r
Then I need to export UIKit in the executable somehow?
s
You can add
-framework UIKit
link options manually. See
linkerOpts
here: https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#using-kotlinnative-targets
r
Usually I put that in the
binaries
framework
block, but here I don’t have that, so I need to search for the binary and apply that in my Gradle file, right?
r
That works, thanks
Copy code
binaries.getByName("testDebugExecutable").linkerOpts("-framework UIKit")