Xcode 7: Linker command failed with exit code 1

Hello


I was building a timer app and when I compile I got this error:

clang error: Linker command failed with exit code 1


And here are the links to the .h and .m files and the error description:

https://www.dropbox.com/s/pcph6imo6ddebcz/Error.zip?dl=0


Any solutions?

Two things:

  • In

    timerRunningViewController.m
    , you’re importing the the ViewController implementation (
    ViewController.m
    ) rather than its header (
    ViewController.h
    ).
  • Within

    ViewController.m
    , you’re declaring
    seconds
    and
    timer
    as global variables whereas I expect you want them to be properties or ivars.

The first point is the immediate cause of your error, in that you’ve defined two implementations of ViewController, which has resulted in a bunch of duplicate symbols at the linker level.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

You can try these solutions. Clean your projects / Set the "Enable bitcode" in Build Settings to No / Delete derived data / Set "No Common Blocks" in Build Settings to No.

If you find this "duplicate symbols for architecture x86_64", you can check the code for duplicate variables or methods. For me, I have "extern"ed an "int" from another class and I declared it again in .m file, so I deleted the "int" variables in .m file and the error was fixed

Xcode 7: Linker command failed with exit code 1
 
 
Q