Reputation: 3
I've been new to xCode and facing this issue while adding a new file to existing project. The error I receive is :
duplicate symbol _main in: /Users/jagtapawan/Library/Developer/Xcode/DerivedData/pdf-gowwoupvsiukblehcdbaeublehki/Build/Intermediates/pdf.build/Debug/pdf.build/Objects-normal/x86_64/main.o /Users/jagtapawan/Library/Developer/Xcode/DerivedData/pdf-gowwoupvsiukblehcdbaeublehki/Build/Intermediates/pdf.build/Debug/pdf.build/Objects-normal/x86_64/func.o ld: 1 duplicate symbol for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
what I do is File -> New -> File. on the left panel select iOS source -> objective c -> next. It insists me to to enter
File: func
File type : Empty
Class : NSObject
my file hierarchy in Xcode is this way :
-func.m
----main.m
--products
whereas in finder the func.m and main.m are in the same folder pdf. please help me
Upvotes: 0
Views: 523
Reputation:
I was able to solve the same problem with the following code.
Add this to the Library Search Paths in Build Settings and make sure you select recursive, delete other library paths which might be absolute paths.
$(PROJECT_DIR)
May be it will help you.
OR
You have duplicate symbol method which means there are duplicate file in project
In your Target's Build Phase, under "Compile Sources" check if there are duplicate file and delete one if you have duplication.
Hope this will help you.
Upvotes: 0