2

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.

WrightsCS
  • 50,551
  • 22
  • 134
  • 186

2 Answers2

3

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.

Bill Burgess
  • 14,054
  • 6
  • 49
  • 86
  • If I want to have files with same name in the project and static libray that is also not possible ? because I am getting same kind of error for the files that have same name in project and static library – hariszaman Sep 03 '14 at 08:24
  • You can't have duplicates anywhere. Project or static library. Which is why Apple asks you if you want to prefix your classes to help avoid this problem. One of them will need to change. – Bill Burgess Sep 03 '14 at 12:58
1

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.

Community
  • 1
  • 1
Josh Bernfeld
  • 4,246
  • 2
  • 32
  • 35