(Если у вас есть идея, какой бы она ни была, напишите ответ, я дам вам +1, даже если это не решило мое дело :))

Только что получил эту ошибку.

Я погуглил и пока не нашел решения.

сбой команды компоновщика с кодом выхода 1 (используйте -v для просмотра вызова) повторяющиеся символы для архитектуры x86_64

clang: error: команда компоновщика завершилась неудачно с кодом выхода 1 (используйте -v для просмотра вызова) повторяющийся символ _sprites для _game

сбой команды компоновщика с кодом выхода 1 (используйте -v, чтобы увидеть вызов) и неопределенными символами для архитектуры

Ld /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Products/Debug-iphonesimulator/AFDateHelperExtObjective-C.app/AFDateHelperExtObjective-C normal x86_64
    cd "/Users/TLL/Desktop/iOS Learn/Objective-C Mark Price Udemy/Ex 6 AFDateHelper /AFDateHelperExtObjective-C"
    export IPHONEOS_DEPLOYMENT_TARGET=9.2
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk -L/Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Products/Debug-iphonesimulator -F/Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Products/Debug-iphonesimulator -filelist /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/AFDateHelperExtObjective-C.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=9.2 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -dependency_info -Xlinker /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/AFDateHelperExtObjective-C_dependency_info.dat -o /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Products/Debug-iphonesimulator/AFDateHelperExtObjective-C.app/AFDateHelperExtObjective-C

duplicate symbol _ISOFormatYear in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _ISOFormatYearMonth in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _ISOFormatDate in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _DotNetDateFormatType in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _CustomDateFormatType in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _AltRSSDateFormatType in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _RSSDateFormatType in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _ISO8601DateFormatType in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _ISOFormatDateTime in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _ISOFormatDateTimeMilliSec in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _ISOFormatDateTimeSec in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/NSDate+AFDateHelperObjC.o
duplicate symbol _ISOFormatYear in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
duplicate symbol _ISOFormatYearMonth in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
duplicate symbol _ISOFormatDate in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
duplicate symbol _DotNetDateFormatType in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
duplicate symbol _CustomDateFormatType in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
duplicate symbol _AltRSSDateFormatType in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
duplicate symbol _RSSDateFormatType in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
duplicate symbol _ISO8601DateFormatType in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
duplicate symbol _ISOFormatDateTime in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
duplicate symbol _ISOFormatDateTimeMilliSec in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
duplicate symbol _ISOFormatDateTimeSec in:
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/ViewController.o
    /Users/TLL/Library/Developer/Xcode/DerivedData/AFDateHelperExtObjective-C-drnbulhrpdtwsbctmtvxzbnfjavn/Build/Intermediates/AFDateHelperExtObjective-C.build/Debug-iphonesimulator/AFDateHelperExtObjective-C.build/Objects-normal/x86_64/DateFormat.o
ld: 22 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Что я пробовал до сих пор:

  • Я не нашел повторяющихся деклараций.
  • Я не нашел где-то неправильного импорта ".h" или ".m".
  • Не использовал "-Obj-C" в настройках сборки

Мой DateFormat.h:

#import <Foundation/Foundation.h>

NSString * const ISO8601DateFormatType = @"ISO8601";
NSString * const DotNetDateFormatType = @"DotNet";
NSString * const RSSDateFormatType = @"RSS";
NSString * const AltRSSDateFormatType = @"AltRSS";
NSString * const CustomDateFormatType = @"Custom";

NSString * const ISOFormatYear = @"yyyy";
NSString * const ISOFormatYearMonth = @"yyyy-MM"; // 1997-07
NSString * const ISOFormatDate = @"yyyy-MM-dd"; // 1997-07-16
NSString * const ISOFormatDateTime = @"yyyy-MM-dd'T'HH:mmZ"; // 1997-07-16T19:20+01:00
NSString * const ISOFormatDateTimeSec = @"yyyy-MM-dd'T'HH:mm:ssZ"; // 1997-07-16T19:20:30+01:00
NSString * const ISOFormatDateTimeMilliSec = @"yyyy-MM-dd'T'HH:mm:ss.SSSZ"; // 1997-07-16T19:20:30.45+01:00

@interface DateFormat : NSObject

+ (instancetype) ISODateFormat: (NSString *) isoFormat;
+ (instancetype) DotNetDateFormat;
+ (instancetype) RSSDateFormat;
+ (instancetype) AltRSSDateFormat;
+ (instancetype) CustomDateFormat: (NSString *) formatString;

@property (readonly) NSString *dateFormatType;
@property (readonly) NSString *formatDetails;

@end
0
user5622777 18 Апр 2016 в 09:45

2 ответа

Лучший ответ

Вы объявили строки в себе .h, используя:

NSString * const ...

Это означает, что каждый файл, который импортирует .h, объявляет один и тот же набор этих строк, и вы получаете повторяющиеся символы.

Вы можете решить эту проблему, делая каждое объявление в .h extern - то есть просто объявляя имя и тип переменной, определенной в другом месте - и удаляя инициализацию; а затем в соответствующий .m включить объявления без extern и с инициализацией.

Альтернативное более короткое, но более уродливое решение - сделать все объявления в .h static и оставить инициализацию. Этот подход дает каждому .m, который включает .h свой собственный частный набор переменных. Немного расточительно по месту, но в остальном работает нормально.

HTH

0
CRD 18 Апр 2016 в 08:30

Похоже, вы дважды добавляли ссылки на AFDateHelper (и сопутствующую категорию на NSDate). Иногда чистка может решить эту проблему. Если нет, выберите этот файл (AFDateHelper.m) в навигаторе, снимите флажок с его принадлежности к цели и попробуйте построить снова. Если он строится, то есть вторая ссылка на файл в другом месте проекта. Лучший

0
Jef 18 Апр 2016 в 07:07