I am trying to this C library. I have added the files to my project, and created an Objective-C file to follow the example on the github page. I have imported the Objc file in my bridging header, but when I compile I
Ld /Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Products/Debug-iphoneos/trinkeSwift.app/trinkeSwift normal arm64
cd /Users/nickporter/Developer/trinkeSwift
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -L/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Products/Debug-iphoneos -F/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Products/Debug-iphoneos -filelist /Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/trinkeSwift.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/trinkeSwift.swiftmodule -miphoneos-version-min=8.0 -framework CoreGraphics -framework Foundation -framework UIKit -Xlinker -dependency_info -Xlinker /Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/trinkeSwift_dependency_info.dat -o /Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Products/Debug-iphoneos/trinkeSwift.app/trinkeSwift
duplicate symbol _str_time in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _mymodifier in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _fromModifier in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _timePointer in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _temp_time in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _set_time in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _curtime in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _initialTime in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _changeAmount in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _fromChangeAmount in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _specAmount in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _finalSpecAmount in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _unusedText in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/DateGenerator.o
duplicate symbol _str_time in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _changeAmount in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _fromChangeAmount in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _temp_time in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _set_time in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _specAmount in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _finalSpecAmount in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _mymodifier in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _fromModifier in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _timePointer in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _curtime in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _initialTime in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
duplicate symbol _unusedText in:
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/TimeParser.o
/Users/nickporter/Library/Developer/Xcode/DerivedData/trinkeSwift-dhbvybojkdowcfffscchwxwgahyj/Build/Intermediates/trinkeSwift.build/Debug-iphoneos/trinkeSwift.build/Objects-normal/arm64/y.tab.o
ld: 28 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The code in my Objc class is
+ (NSDate *)dateFromNatrualString:(NSString *)text
{
NSString *when = text.lowercaseString;
char *whenstr = (char *)[when UTF8String];
time_t finalTime = parseDateTimeString(whenstr);
str_time= localtime(&finalTime);
NSString *thedate = [NSString stringWithCString:asctime(str_time) encoding:NSUTF8StringEncoding];
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
formatter.dateFormat = @"EEEE MMM dd HH:mm:ss yyyy";
return [formatter dateFromString:thedate];
}
Does anyone know how I can fix this?
The library you are using is defining symbols inside the TimeParser.h file. Whenever you include that file in your project in more than one of your files, you end up with duplicate definitions. As an example, the first 3 entries in your error log correspond to variables that are defined in TimeParser.h : str_time
, mymodifier
and frommodifier
.
TimeParser.h should only contain declarations in order to avoid this problem. To help you with the difference between declaration and definition, refer to this post : What is the difference between a definition and a declaration?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With