While using two static library in project, conflict due to class with same name compiled in both static libraries

可紊 提交于 2019-12-11 02:01:41

问题


I have implemented two static library having the following structure:

FirstStaticLibrary.a

BaseClass.h

@interface BaseClass

-some methods

@end

FirstDerivedClass.h

@interface FirstDerivcedClass:BaseClass
{
}

-some methods

@end

SecondStaticLibrary.a

BaseClass.h

@interface BaseClass

-some methods;

@end

SecondDerivedClass.h

@interface SecondDerivedClass:BaseClass
{
}

-someMethods;

@end

Above two static library is having the common file BaseClass.h and BaseClass.m

These static libraries are added into TestApplication Project.

But while running the application, it's throwing an error:

Duplicate symbols found in /User/Library/Developer/Xcode/..E./FirstStaticLibrary.a (BaseClass.o) and /User/Library/Developer/Xcode/..E./SecondStaticLibrary.a (BaseClass.o) for architecture i386

Please suggest a way to remove this error.


回答1:


The answer is one you probably don't want to hear, but you will have to change the name in one of your libraries. Assuming you have access to both libraries that is.




回答2:


This answer is probably one you will want to hear! I managed to find a solution that works! Hopefully others will learn that even when they include other APIs into their frameworks, they still always need to place their prefix on the classes. Look here.



来源:https://stackoverflow.com/questions/8517427/while-using-two-static-library-in-project-conflict-due-to-class-with-same-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!