1

I'm using Xcode Version 6.0.1 (6A317)and stuck with Apple Mach-O error for a long time. I get this error once I introduce SocketRocket project.

duplicate symbol _OBJC_IVAR_$_AppDelegate._window in:

    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-113CA4C4B5D4CC68.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-D68FF7E1CDB59174.o
duplicate symbol _OBJC_METACLASS_$_AppDelegate in:
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-113CA4C4B5D4CC68.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-D68FF7E1CDB59174.o
duplicate symbol _OBJC_CLASS_$_AppDelegate in:
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-113CA4C4B5D4CC68.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-D68FF7E1CDB59174.o
duplicate symbol _OBJC_CLASS_$_ViewController in:
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-7B952F801D984E6D.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-99529767CD55CC78.o
duplicate symbol _OBJC_METACLASS_$_ViewController in:
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-7B952F801D984E6D.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-99529767CD55CC78.o
duplicate symbol _main in:
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/main-B74D1ABF07758C74.o
    /Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/main-F48A7B3907D55170.o
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have made sure to follow the steps given in https://github.com/square/SocketRocket

the only exception I see is SocketRocket.framework was showing red when I tried adding it under + Link Binary with libraries.

I have added the following libraries:

Security.Framework
CFNetwork.Framework
UIKit.Framework
Foundation.Framework
libicucore.dylib
libsocketrocket.a
libresolv.dylib

I've set other linker flags to -ObjC Build Active Architecture only - No, because setting it to Yes throws an error : Check dependencies. No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386). Valid Architectures - armv64 armv7 armv7s

This issue is really killing my time. I tried to follow other posts but nothing could help me solve the issue!

4

1 回答 1

1

1.-您是否在另一个 .m 文件而不是 Header 中导入 .m 文件?它有时会发生错误并导致该问题。

2.- 在 Build Phases 下检查您的 Compile Sources 是否包含相同的文件 2 次,尽管从外观上看这似乎不是问题。

3.- 如果一切都失败了。在 Organizer 中清理项目的 DerivedData 文件夹。清理并重新构建。

于 2014-10-02T10:39:26.733 回答