1

I am facing an issue where I am getting a compile time error which says duplicate symbol _OBJC_CLASS_$_XYZ in lib1 and lib 2. Looks like the class name is same in both the libs.

How to get rid of this situation? Any clue.

Abhinav
  • 37,684
  • 43
  • 191
  • 309

2 Answers2

2

Simple: Change the name of one of the classes. (No, this really isn't simple as you have to change every usage of that class name in the library). Since objective-c is a dynamic language, there cannot be two classes with the same name. Classes are used at runtime to determine everything about the objects you create. To avoid naming conflicts, you should always use prefixes when creating shared libraries.

See Code Naming Basics, specifically the "Class and Protocol Names" section.

ughoavgfhw
  • 39,734
  • 6
  • 101
  • 123
1

Looks like you must rename one of them or have only one loaded at any given time.

What is the best way to solve an Objective-C namespace collision?

Community
  • 1
  • 1
FreeAsInBeer
  • 12,937
  • 5
  • 50
  • 82