agi18n agimagechecker amazonaws android arc autolayout blog building cache calabash certificates clean code cocoa cocoapods data binding debugging deployment target drm ebs ec2 errors facebook fix git i18n images instruments interface builder ios iosx enterpise summit ipad iphone iphone5 kotlin libraries like button linking links llvm memory management method swizzling mobile model mvc mvvm nil objective-c optimizations patch patterns performance presentation provisioning profiles restkit runtime rxjava rxswift security shadows streaming svn swift testing tools tutorials uikit uistackview video view xcode

Subscribe to this blog

Tag: linking

How to fix a "Duplicated Symbols" error on binary files

Angel G. Olloqui 17 October, 2013


When including third party libraries into your project, you can run into a “Duplicated Symbols” error on the linking process. This annoying error is due to a name collision between one or more of your classes, usually caused by either:
  • You do not use a prefix as namespace and you use a generic name such as Session, User or similar. This has an easy solution, as all you need to do is rename your classes to use a prefix. For example, User could be renamed into AGUser. Using prefixes is a good practice that you should always follow in programming languages without namespaces like C or Objective-C.
  • One or more of your libraries are including the same third party library. This is quite common on static frameworks and libraries built with little care. Usually, the creator of the library includes generic utilities such as SBJON, Reachability and similars inside the compiled binary. Then, your project or some other library also making use of it tries to include it again, resulting in the duplicated symbols error. If you have access to the source code, it could be solved easily by leaving the duplicated one out of your target. Unfortunately, when this problem occurs, many times comes from compiled libraries or frameworks that do not give us control on the source code files but just a binary instead. Solving this issue may not seem easy or even possible, but as we are going to see in this post it is not so difficult as it may look.

Tags: libraries, tools, errors, linking, building, fix