Home > Back-end >  How to Link a framework required by a macOS bundle when building an xcode project requiring this bun
How to Link a framework required by a macOS bundle when building an xcode project requiring this bun

Time:11-11

I have a macOSX bundle project B, which requires the GameKit framework. I can compile it into a bundle, creating B.bundle.

I put this B.bundle inside project A which requires this bundle to work. When I try to build project A, I got a linkage error:

"__OBJC_CLASS_$_GKAccessPoint", referenced from:
obj-class-ref in ....
 "__OBJC_CLASS_$_GKLocalPlayer", referenced from:
obj-class-ref in ....

ld: symbol(s) not found for architecture arm64

GKAccessPoint and GKLocalPlayer are the two classes used by my bundle project. It looks like it doesn't find the classes at all (I have tried building for other architecture and it also fails but the architecture name chagnes).

I don't really know how to make the linkage work. Here are the settings inside my project B:

bundle B settings

And here the settings in my project A:

project A settings

Thanks!

CodePudding user response:

Alright, so after struggling for a day, I found out what was the problem.

I was generating the main project using unity, and the native GameKitNativebundle.bundle, as well as the GameKitNativebundle.mm files are inside the project, under the Assets folder.

The problem was I had ticked the .mm files as to be included in the standalone version. So xcode was trying to compile this .mm file directly and was trying to link it, which failed.

Unticking the standalone checkbox in the .mm files and rebuilding the xcode project from unity made the project link again.

  • Related