1 duplicate symbol for architecture x86_64

15,876

Solution 1

You need to add necessary framework to your project. Check all third party party framework and search its required framework for support. For e.g. if you add google analytic then you need to add CoreData , Foundation etc framework. There is some framework is missing for which third party framework needs.

Or you can-

  1. Press "Cmd + Shift + K" or shift + cmd + alt + k to clean up, and quit Xcode.
  2. Delete the cache Run "rm -rf ~/Library/Developer/Xcode/DerivedData" in terminal

  3. Open the project and re-build it

Linker command failed with exit code 1 - to solve this error press "Cmd + Shift + K" or shift + cmd + alt + k this will do the work for you. I also have this same issue but solved by using this line . Hope this will solve your problem.

OUTPUT OF YOUR PROJECT -

enter image description here

enter image description here

Solution 2

duplicate symbol _main

You have two main.m files and the function main() is in conflict.

enter image description here

Just delete the main.m under CERangeSlider and it should work.

Solution 3

I have cloned your project from github, I found that the main.m file is repeated in SFITNESS and CERangeSlider You may delete one of them and your project will work.

Share:
15,876

Related videos on Youtube

Hanz Cheah
Author by

Hanz Cheah

Trying to become a full stack developer. Started to learn web development with classic ASP, HTML, Javascript and CSS. Wrote my 1st iOS apps with Objective C. Still learning and thanks to all who has helped me.

Updated on September 16, 2022

Comments

  • Hanz Cheah
    Hanz Cheah over 1 year

    I am not sure what I have done wrong.
    I moved my project folder to another folder and copied the backup folder to desktop.
    I tried to open the backup project and build, I received the linker error.
    So I decided to I delete my backup folder and moved back my project folder to desktop. I can't compile anymore and received the following error.

     Showing Recent Issues clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    duplicate symbol _main in:
    /Users/BRO/Library/Developer/Xcode/DerivedData/SFITNESS-flzvwdymttxhducvwvmhpuaqfzhj/Build/Intermediates.noindex/SFITNESS.build/Debug-iphonesimulator/SFITNESS.build/Objects-normal/x86_64/main-90EC778DD760FD57.o
    /Users/BRO/Library/Developer/Xcode/DerivedData/SFITNESS-flzvwdymttxhducvwvmhpuaqfzhj/Build/Intermediates.noindex/SFITNESS.build/Debug-iphonesimulator/SFITNESS.build/Objects-normal/x86_64/main-F627C2B37F247040.o
    ld: 1 duplicate symbol for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)  
    

    Help Needed

    No derived data folder

    pic

    Still the same

    1. I opened Derived Data folder and deleted everything in it
    2. I deletes all the project in all simulator
    3. I restarted xCode, Clean and build

    Still the same Pic 2

    Added the project into GitHub

    The link

    • dahiya_boy
      dahiya_boy about 6 years
      have you deleted you driveddata ??
  • Hanz Cheah
    Hanz Cheah about 6 years
    Hi, I have tried your step but still the same error?
  • Hanz Cheah
    Hanz Cheah about 6 years
    Hi thanks Rashed, I have tried your solution but it didn't work. Tried many times to delete the DerivedData and restart xCode. It still won't build.
  • Rashed
    Rashed about 6 years
    did you try shift + cmd + alt + k?
  • Hanz Cheah
    Hanz Cheah about 6 years
    I suspect some files or code that I have downloaded from gitHub which I have added long time ago that was not properly referenced in objective C after I have copy the folder around.
  • Rashed
    Rashed about 6 years
    that will not be a problem
  • matt
    matt over 4 years
    This answer has been edited to add spam images, and should probably be removed.