Avoiding duplicate symbol issues when using common utilities within a static library
I’m working on two projects right now that have static library products, to be given to other developers to use in their projects: [Audiobus](http://audiob.us) and [The Amazing Audio Engine](http://theamazingaudioengine.com). In both cases, I’m making quite heavy use of my circular buffer code, [TPCircularBuffer](http://github.com/michaeltyson/TPCircularBuffer), which would result in duplicate symbol errors if the static library were linked with another project that used it.
In case the solution was useful to others, here’s how I worked around it: Use the preprocessor to rename the symbols automatically during the build phase.
This is done by adding a series of -DOldSymbol=NewSymbol
flags to the ‘Other C Flags’ build setting – like -DTPCircularBuffer=ABCircularBuffer
, for instance.
No more symbol conflicts.
Read More