Search code examples
iphoneiosobjective-cipadios7

Apple Mach-O Linker Error, Objective C


I am trying to compile my application but it always has this error 'Apple Mac-O Linker Error linker command failed with exit code 1 (use -v to see invocation)' Here's the code for the error:

Ld /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Products/Debug-iphonesimulator/Tap!.app/Tap! normal i386
    cd "/Users/Sarthak/Documents/Programming/iOS and Mac OSX Programming/iOS/Tap!"
    setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Products/Debug-iphonesimulator -F/Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Products/Debug-iphonesimulator -filelist /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/Tap!.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -framework CoreGraphics -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/Tap!_dependency_info.dat -o /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Products/Debug-iphonesimulator/Tap!.app/Tap!

duplicate symbol _OBJC_IVAR_$_tapScoreController.score in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapViewController.o
duplicate symbol _OBJC_IVAR_$_tapScoreController.gameStart in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapViewController.o
duplicate symbol _OBJC_METACLASS_$_tapScoreController in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapViewController.o
duplicate symbol _OBJC_CLASS_$_tapScoreController in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapViewController.o
duplicate symbol _OBJC_IVAR_$_tapScoreController.score in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/main.o
duplicate symbol _OBJC_IVAR_$_tapScoreController.gameStart in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/main.o
duplicate symbol _OBJC_METACLASS_$_tapScoreController in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/main.o
duplicate symbol _OBJC_CLASS_$_tapScoreController in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/main.o
duplicate symbol _OBJC_IVAR_$_tapScoreController.score in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapAppDelegate.o
duplicate symbol _OBJC_IVAR_$_tapScoreController.gameStart in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapAppDelegate.o
duplicate symbol _OBJC_METACLASS_$_tapScoreController in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapAppDelegate.o
duplicate symbol _OBJC_CLASS_$_tapScoreController in:
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapScoreController.o
    /Users/Sarthak/Library/Developer/Xcode/DerivedData/Tap!-gtxtrvaffmxxtocfqejemafixgvx/Build/Intermediates/Tap!.build/Debug-iphonesimulator/Tap!.build/Objects-normal/i386/tapAppDelegate.o
ld: 12 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution

  • I figured out what was wrong, I was importing the .h file into viewController.h and view controller.m, that's why it didn't work.