Apple Mach-O Linker (id) Error Linker command failed with exit code 1, loads of duplicate symbol errors, works fine outside of xcode

StackOverflow https://stackoverflow.com/questions/11872213

Question

I'm currently learning how to use Objective-C And I was doing a simple project involving classes I decided to plop it into Xcode for some easy visual debugging but upon ironing out all the errors and warnings I ran into that:

duplicate symbol _OBJC_IVAR_$_Customer._fName in:
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/main.o
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/NRaI.o
duplicate symbol _OBJC_IVAR_$_Customer._lName in:
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/main.o
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/NRaI.o
duplicate symbol _OBJC_IVAR_$_Customer._age in:
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/main.o
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/NRaI.o
duplicate symbol _OBJC_IVAR_$_Customer._rank in:
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/main.o
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/NRaI.o
duplicate symbol _OBJC_IVAR_$_Customer._intention in:
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/main.o
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/NRaI.o
duplicate symbol _OBJC_METACLASS_$_Customer in:
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/main.o
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/NRaI.o
duplicate symbol _OBJC_CLASS_$_Customer in:
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/main.o
/Users/Slench/Library/Developer/Xcode/DerivedData/NameRankIntention-hlaqvlslfjimqdeysxqiyloirdus/Build/Intermediates/NameRankIntention.build/Debug/NameRankIntention.build/Objects-normal/x86_64/NRaI.o
ld: 7 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Now the weird thing is that I then put the "fixed code" back into Sublime Text, where I saved it and then compiled it through the terminal where it worked just fine no errors no warnings nothing

I've read through some of the other questions regarding this and the solution has either always been that they have found the duplicate declaration, or that they had an extra file by the same name that resulted in duplicate declarations... I have neither...

so... any help?

Was it helpful?

Solution

Are you possibly importing the 'NRaI.m' file in main.m by accident?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top