Duplicate symbols for architecture x86_64 under Xcode - Printable Version +- 0Day Forums (https://zeroday.vip) +-- Forum: Coding (https://zeroday.vip/Forum-Coding) +--- Forum: Objective-C (https://zeroday.vip/Forum-Objective-C) +--- Thread: Duplicate symbols for architecture x86_64 under Xcode (/Thread-Duplicate-symbols-for-architecture-x86-64-under-Xcode) |
Duplicate symbols for architecture x86_64 under Xcode - misniac161646 - 07-21-2023 I now have the same question with above title but have not found the right answer yet. I got the error: /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Intermediates/TestMoboSDK-Client.build/Debug-iphonesimulator/TestMoboSDK-Client.build/Objects-normal/x86_64/MoboSDK.o /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Products/Debug-iphonesimulator/libMoboSDK.a(MoboSDK.o) duplicate symbol _OBJC_METACLASS_$_MoboSDK in: /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Intermediates/TestMoboSDK-Client.build/Debug-iphonesimulator/TestMoboSDK-Client.build/Objects-normal/x86_64/MoboSDK.o /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Products/Debug-iphonesimulator/libMoboSDK.a(MoboSDK.o) ld: 75 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Any help is appreciated. **Finally** I find out the reason of this error cause I added `-ObjC` to the `Other Linker Flags`. After remove this value then I can build my project successfully, but I don't know why. Can anyone explain this? RE: Duplicate symbols for architecture x86_64 under Xcode - jaxsonhw - 07-21-2023 Stupid one, but make sure you haven't `#import`ed a `.m` file by mistake somewhere RE: Duplicate symbols for architecture x86_64 under Xcode - nicoletteusicndnok - 07-21-2023 I found the accepted answer touches on the problem but didn't help me solve it, hopefully this answer will help with this very frustrating issue. duplicate symbol _OBJC_IVAR_$_BLoginViewController._hud in: 17 duplicate symbols for architecture x86_64 *"Means that you have loaded same functions twice. As the issue disappear after removing -ObjC from Other Linker Flags, this means that this option result that functions loads twice:"* In layman's terms this means we have two files in our project with exactly the same name. Maybe you are combining one project into another one? Have a look at the errors above the "duplicate symbols" error to see which folder is duplicated, in my case it was BLoginViewController. For example, in the image below you can see I have two BImageViewControllers, for me this is what was causing the issue. As soon as I deleted one then the issue vanished :) ![enter image description here][1] [1]: RE: Duplicate symbols for architecture x86_64 under Xcode - unswollen84077 - 07-21-2023 Remove -ObjC from Other Linker Flags or Please check you imported any .m file instead of .h by mistake. RE: Duplicate symbols for architecture x86_64 under Xcode - holly5 - 07-21-2023 Happens also when you declare const variables with same name in different class: in file Message.m const int kMessageLength = 36; @implementation Message @end in file Chat.m const int kMessageLength = 20; @implementation Chat @end RE: Duplicate symbols for architecture x86_64 under Xcode - Mrsupertanker6 - 07-21-2023 Same issue happen with me, when I was integrating the lob project inside my project. ![enter image description here][1] Actually lob project also have the AFNetworking files, So I remove the .m files from lob project. ![enter image description here][2] Actually .m files are conflicting with My project POd/AFNetworking/ .m files ![enter image description here][3] [1]: [2]: [3]: RE: Duplicate symbols for architecture x86_64 under Xcode - housings144833 - 07-21-2023 Following steps solved the issue for me. 1. Go to Build Phases in Target settings. 2. Go to “Link Binary With Libraries”. 3. Check if any of the libraries exist twice. 4. Build again. RE: Duplicate symbols for architecture x86_64 under Xcode - marioqzotadi - 07-21-2023 In Xcode 6.3.2. I have checked all possibility like as belowed 1: I have not import .m file in my project. 2: Removed `-ObjC` from **Other linker flag**. 3: Removed all my **derive Data**. still i am getting same error. **I have removed this error by removing any variable declaration from `.pch` file**. in my case, i have declared `AppDelegate` object in `.pch` file. finally i found reason that cause error. so i remove declaration of any variable from .pch file and my project working charm. RE: Duplicate symbols for architecture x86_64 under Xcode - Mrpaulienfsswnsat - 07-21-2023 Recently had a headache looking for source of an error. I was wondered, when i found out that my app doesn't want to compile, simply because i had following code snippet in different classes: dispatch_time_t getDispatchTimeByDate(NSDate *date) { NSTimeInterval interval; double second, subsecond; struct timespec time; dispatch_time_t milestone; interval = [date timeIntervalSince1970]; subsecond = modf(interval, &second); time.tv_sec = second; time.tv_nsec = subsecond * NSEC_PER_SEC; milestone = dispatch_walltime(&time, 0); return milestone; } Hope that might help someone. RE: Duplicate symbols for architecture x86_64 under Xcode - unity646 - 07-21-2023 For me, changing 'No Common Blocks' from Yes to No ( under Targets->Build Settings->Apple LLVM - Code Generation ) fixed the problem. |