Reputation: 353
I'm not sure what I did but I added an IBOutlet to display an additional attribute in a TableView cell. When building the application I get the following error message...
Ld /Users/roberthill/Library/Developer/Xcode/DerivedData/PHAInspect-awfhtfopjdgfmsdsjfjivdnlzgir/Build/Products/Debug-iphonesimulator/PHAInspect.app/PHAInspect normal i386
cd /Users/roberthill/Documents/PHAInspect
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/roberthill/Library/Developer/Xcode/DerivedData/PHAInspect-awfhtfopjdgfmsdsjfjivdnlzgir/Build/Products/Debug-iphonesimulator -F/Users/roberthill/Library/Developer/Xcode/DerivedData/PHAInspect-awfhtfopjdgfmsdsjfjivdnlzgir/Build/Products/Debug-iphonesimulator -filelist /Users/roberthill/Library/Developer/Xcode/DerivedData/PHAInspect-awfhtfopjdgfmsdsjfjivdnlzgir/Build/Intermediates/PHAInspect.build/Debug-iphonesimulator/PHAInspect.build/Objects-normal/i386/PHAInspect.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework CoreData -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/roberthill/Library/Developer/Xcode/DerivedData/PHAInspect-awfhtfopjdgfmsdsjfjivdnlzgir/Build/Products/Debug-iphonesimulator/PHAInspect.app/PHAInspect
ld: duplicate symbol _OBJC_METACLASS_$_Inspection in /Users/roberthill/Library/Developer/Xcode/DerivedData/PHAInspect-awfhtfopjdgfmsdsjfjivdnlzgir/Build/Intermediates/PHAInspect.build/Debug-iphonesimulator/PHAInspect.build/Objects-normal/i386/Inspection-AEDA73D75B42426A.o and /Users/roberthill/Library/Developer/Xcode/DerivedData/PHAInspect-awfhtfopjdgfmsdsjfjivdnlzgir/Build/Intermediates/PHAInspect.build/Debug-iphonesimulator/PHAInspect.build/Objects-normal/i386/Inspection-AEDA73D75B42426A.o for architecture i386
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
I tried backing out the changes to add the IBOutlet but I'm still getting this error message.
I checked other similar posts but I don't think the conditions are the same (I could be wrong though). Any ideas?
Upvotes: 7
Views: 18958
Reputation: 2180
i had meet same problem, and i solved it. When i copy and paste my view and view controller with different name, i got this error (dublicate sembol in _temp). i solved this error by changing constant name. You can also move your constant between implemantation bracets. My examples code below. And my constant name is temp.
@implementation MyCombineSaveTableView
{
BOOL *pulltoRefResh;
NSString *currentElement;
int temp;
int User_ID;
}
Upvotes: 0
Reputation: 32320
If more than one class shares a same name this kind of error will come
Upvotes: 1
Reputation: 4209
I had this problem . I solve it.
Because ı did mistake when ı import to viewcontroller .
mistake: #import "viewcontroller.m"
Later I edit : `#import "viewcontroller.h"
only I changed extension of viewcontroller .
Upvotes: 3
Reputation: 10375
This may happen also if you have constant definitions with the same name in two different classes. In my case it was a boolean flag like these:
Class A:
#import "MyATableViewController.h"
@implementation MyATableViewController
@synthesize someVariable;
BOOL MY_FLAG = YES;
...
Class B:
#import "MyBTableViewController.h"
@implementation MyBTableViewController
@synthesize someVariable;
BOOL MY_FLAG = YES;
...
I just had to change the constant definition on the second class to:
... BOOL MY_B_FLAG = YES; ...
Upvotes: 0
Reputation: 2171
I dont really understand why this would be a problem so maybe someone could clarify but for me the problem was that I had imported another class which had declared an instance variable with the same name as one in the current class.
When I changed the name of the ivar in the imported class's implementation the error disappeared.
Hope this helps!
Upvotes: 0
Reputation: 2589
Other than the .m issue, if you created models in the wrong folder, deleted them and then created/replaced the models in the correct folder. You may need to remove the duplicates in Targets Build Phases under the Compiled Sources grouping.
Upvotes: 11
Reputation: 1141
In my first app, I had this problem after replacing a class. As I didn't want to delete the old class completely, I moved it to another group, still within xcode. xcode tries to compile two copies of this class, causing the error. Deleting the references to the old class from the project fixed my problem.
Upvote went to quarac, who made this easier for me to spot.
Upvotes: 2
Reputation: 104718
This can happen when a source is compiled in your target twice, or if it is built in two separate targets. You can verify this in your target's build phases, or remove it from the target and then re-add it.
Update
Kasas pointed out a new Xcode feature (in an Edit which other reviewers rejected), where Xcode can detect some such cases for you -- Simply "Validate" the target or project settings. If found, Xcode will offer to remove the redundant compilation for you. Thanks Kasas.
Upvotes: 20
Reputation: 3483
I had a similar issue:
ld: duplicate symbol _OBJC_METACLASS_$_MyClass1 in /Users/.../MyClass2.o and /Users/.../MyClass1.o for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And finally the reason was that inside MyClass2.m I wrote:
#include "MyClass1.m"
Instead of
#include "MyClass1.h"
It's hard to find when you have a lot of #include statements inside your .m file.
Upvotes: 51
Reputation: 40018
This might b due to the reason that you have included two source files of Inspection
class
Upvotes: 0
Reputation: 21903
Not sure, but a silly question - did you do a clean after clearing the old code? Sometimes that stuff hangs around.
Upvotes: 1