开发者

Duplicate symbol between two libraries

开发者 https://www.devze.com 2023-01-16 18:17 出处:网络
I have the following problem: I\'m linking against the Admob library which contains some part of the GData API. But I also want to link wit开发者_运维知识库h the GData static library to use it directl

I have the following problem: I'm linking against the Admob library which contains some part of the GData API. But I also want to link wit开发者_运维知识库h the GData static library to use it directly in my own application.

Of course, I get duplicate symbols at link time.

How can I avoid that?


The Objective-C GData library includes a header, GDataTargetNamespace.h, with macros to redefine every class in the library.

You can include the header in your project and define a prefix in your target build settings, like

-DGDATA_TARGET_NAMESPACE=MyApp

That will add the prefix to every class in the GData library for your application.

This is really a bug in the Admob library, though.


There is no way to do that. You may want to read my related answer here. Basically there is only one way for you to do this: Modify the Admob library such that it uses the same GData static library.

On second thought, I'd say you could also load either of the libraries at runtime. The name conflicts will persist, but each objective-C symbol will be overridden. Not sure whether this really works. The first method is nicer, too.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号