Reputation: 4187
I'm trying to add a custom framework into 2 projects but an error occurred.
duplicate symbol _OBJC_CLASS_$_ApiECV in:
/Users/kevinmachado/Library/Developer/Xcode/DerivedData/EnvDevTestiPad-bvscnxvnzjltpxcxuoomuaqqsxpj/Build/Products/Debug-iphonesimulator/libAPI_ECV.a(ApiECV.o)
/Users/kevinmachado/Library/Developer/Xcode/DerivedData/EnvDevTestiPad-bvscnxvnzjltpxcxuoomuaqqsxpj/Build/Products/Debug-iphonesimulator/libMKCalendar.a(ApiECV.o)
duplicate symbol _OBJC_METACLASS_$_ApiECV in:
/Users/kevinmachado/Library/Developer/Xcode/DerivedData/EnvDevTestiPad-bvscnxvnzjltpxcxuoomuaqqsxpj/Build/Products/Debug-iphonesimulator/libAPI_ECV.a(ApiECV.o)
/Users/kevinmachado/Library/Developer/Xcode/DerivedData/EnvDevTestiPad-bvscnxvnzjltpxcxuoomuaqqsxpj/Build/Products/Debug-iphonesimulator/libMKCalendar.a(ApiECV.o)
ld: 2 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I think this error is coming because I try to compile twice my custom framework.
I have 3 projects on my workspace. API_ECV
and iPadTest
are both calling MKCalendar
as framework
You can take a look here :
iPadTest
build phase :
API_ECV
build phase :
If I delete the link in API_ECV
no error occurred but I can't use MKCalendar framework
Anyone have an idea ? Can I link my custom framework without compiling it twice ?
Thx ;)
Upvotes: 0
Views: 129
Reputation: 18816
You have two choices:
For a simple dependency like yours, just remove libMKCalendar.a
from either iPadTest
or API_ECV
. Then it will be linked exactly once. (You would need to specify path to its headers were the compiler to have problems).
If you have more complicated dependencies, just turn MKCalendar
into a framework, then it can be intelligently reused by different targets. iOS frameworks are available if you use Xcode 6 beta.
Upvotes: 1
Reputation: 14419
From what you posted, I guess that:
So here is where your duplicate comes from, API_ECV twice from direct link and MKCalendar link. Two possible solutions:
Upvotes: 1