I am attempting to call the CFSwapInt32HostToBig(<#arg: UInt32#>) method in swift file. I have added the CoreFoundation Framework to the project and I have "import CoreFoundation" at the top of my swift file. When I begin to type the method name, XCode suggest the method indicating to me that Xcode is recognizing methods from that framework. I have no errors in Xcode implying that all of my syntax is correct, but when I build I get the following error.
> Ld DerivedData/AudioToy/Build/Products/Debug-iphonesimulator/AudioToy.app/AudioToy normal x86_64
cd /Users/michaliberman/Documents/Projects/Swift/AudioToy
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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 x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -L/Users/michaliberman/Documents/Projects/Swift/AudioToy/DerivedData/AudioToy/Build/Products/Debug-iphonesimulator -F/Users/michaliberman/Documents/Projects/Swift/AudioToy/DerivedData/AudioToy/Build/Products/Debug-iphonesimulator -filelist /Users/michaliberman/Documents/Projects/Swift/AudioToy/DerivedData/AudioToy/Build/Intermediates/AudioToy.build/Debug-iphonesimulator/AudioToy.build/Objects-normal/x86_64/AudioToy.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/michaliberman/Documents/Projects/Swift/AudioToy/DerivedData/AudioToy/Build/Intermediates/AudioToy.build/Debug-iphonesimulator/AudioToy.build/Objects-normal/x86_64/AudioToy.swiftmodule -mios-simulator-version-min=8.0 -framework CoreFoundation -framework AVFoundation -framework AudioToolbox -Xlinker -dependency_info -Xlinker /Users/michaliberman/Documents/Projects/Swift/AudioToy/DerivedData/AudioToy/Build/Intermediates/AudioToy.build/Debug-iphonesimulator/AudioToy.build/Objects-normal/x86_64/AudioToy_dependency_info.dat -o /Users/michaliberman/Documents/Projects/Swift/AudioToy/DerivedData/AudioToy/Build/Products/Debug-iphonesimulator/AudioToy.app/AudioToy
Undefined symbols for architecture x86_64:
"_CASwapFloat32", referenced from:
_CASwapFloat32HostToBig in AudioStudio.o
"__OSSwapInt32", referenced from:
_CFSwapInt32HostToBig in AudioStudio.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have removed and re-imported the framework, but I still get the error. When I option-click on the method name it shows me the header file in which the method is declared and it if I click on that header file I see that it is within the framework. I am not sure what to do when the problem appears to be within the framework.
Use the bigEndian and littleEndian methods
let valueLE16 = 16
let valueBE16 = valueLE16.bigEndian
println("valueLE16: \(valueLE16)") // valueLE16: 16
println("valueBE16: \(valueBE16)") // valueBE16: 1152921504606846976
let valueLE16: Int16 = 16 //UnsafePointer<UInt16>(value.bytes)[0]
let valueBE16: Int16 = valueLE16.bigEndian
println("valueLE16: \(valueLE16)") // valueLE16: 16
println("valueBE16: \(valueBE16)") // valueBE16: 4096
Related
I have been learning how to use Godot and recently I tried to export my project to Xcode to see how my game would look on my phone. When I try to run it, it shows that there are exactly 100 errors.
The error code is huge!
Ld /Users/tonymartini/Library/Developer/Xcode/DerivedData/Wheel-hbetymftcixgfwcvonanonkkbxsz/Build/Products/Debug-iphoneos/Wheel.app/Wheel normal (in target 'Wheel' from project 'Wheel')
cd /Users/tonymartini/Desktop/Godot\ Round\ 2
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-ios12.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk -L/Users/tonymartini/Library/Developer/Xcode/DerivedData/Wheel-hbetymftcixgfwcvonanonkkbxsz/Build/Products/Debug-iphoneos -L/Users/tonymartini/Desktop/Godot\ Round\ 2 -F/Users/tonymartini/Library/Developer/Xcode/DerivedData/Wheel-hbetymftcixgfwcvonanonkkbxsz/Build/Products/Debug-iphoneos -F. -FWheel -FWheel/dylibs -filelist /Users/tonymartini/Library/Developer/Xcode/DerivedData/Wheel-hbetymftcixgfwcvonanonkkbxsz/Build/Intermediates.noindex/Wheel.build/Debug-iphoneos/Wheel.build/Objects-normal/arm64/Wheel.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/tonymartini/Library/Developer/Xcode/DerivedData/Wheel-hbetymftcixgfwcvonanonkkbxsz/Build/Intermediates.noindex/Wheel.build/Debug-iphoneos/Wheel.build/Objects-normal/arm64/Wheel_lto.o -Xlinker -no_deduplicate -stdlib\=libc++ -framework StoreKit /Users/tonymartini/Desktop/Godot\ Round\ 2/Wheel.a -framework GameKit -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/tonymartini/Library/Developer/Xcode/DerivedData/Wheel-hbetymftcixgfwcvonanonkkbxsz/Build/Intermediates.noindex/Wheel.build/Debug-iphoneos/Wheel.build/Objects-normal/arm64/Wheel_dependency_info.dat -o /Users/tonymartini/Library/Developer/Xcode/DerivedData/Wheel-hbetymftcixgfwcvonanonkkbxsz/Build/Products/Debug-iphoneos/Wheel.app/Wheel
Undefined symbols for architecture arm64:
"_mono_get_exception_argument", referenced from:
godot_icall_Array_CopyTo(Array*, _MonoArray*, int) in Wheel.a(collections_glue.iphone.opt.debug.arm64.o)
godot_icall_Dictionary_Add(Dictionary*, _MonoObject*, _MonoObject*) in Wheel.a(collections_glue.iphone.opt.debug.arm64.o)
"_mono_get_exception_index_out_of_range", referenced from:
godot_icall_Array_At(Array*, int) in Wheel.a(collections_glue.iphone.opt.debug.arm64.o)
godot_icall_Array_At_Generic(Array*, int, unsigned int, GDMonoClass*) in Wheel.a(collections_glue.iphone.opt.debug.arm64.o)
godot_icall_Array_SetAt(Array*, int, _MonoObject*) in Wheel.a(collections_glue.iphone.opt.debug.arm64.o)
godot_icall_Array_Insert(Array*, int, _MonoObject*) in
...
"_mono_type_full_name", referenced from:
GDMonoUtils::get_type_desc(_MonoType*) in
I reached the character limit so I cut out the middle, let me know if you want it
GDMono::get_class(_MonoClass*) in Wheel.a(gd_mono.iphone.opt.debug.arm64.o)
GDMono::~GDMono() in Wheel.a(gd_mono.iphone.opt.debug.arm64.o)
_GodotSharp::get_domain_id() in Wheel.a(gd_mono.iphone.opt.debug.arm64.o)
CSharpLanguage::debug_get_current_stack_info() in Wheel.a(csharp_script.iphone.opt.debug.arm64.o)
CSharpInstance::_internal_new_managed() in Wheel.a(csharp_script.iphone.opt.debug.arm64.o)
CSharpScript::_create_instance(Variant const**, int, Object*, bool, Variant::CallError&) in Wheel.a(csharp_script.iphone.opt.debug.arm64.o)
...
"_mono_runtime_set_main_args", referenced from:
GDMono::initialize() in Wheel.a(gd_mono.iphone.opt.debug.arm64.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Something I tried is talked about here: Link. Basically, download visual studio and export Xamarin dylib to Xcode project. The problem with this, as left unsolved in the post, is that instead of the hundred errors, a single new error appears:
"Unresolved symbol: gdmonosetupaot"
I'm trying to learn a framework flow using this guide: https://www.raywenderlich.com/126365/ios-frameworks-tutorial. Created a separate cocoa framework project, moved some code there - it builds successfully, resulting in DehancerNavigation.framework file.
Now I'm trying to add this framework to another project: just created a blank project for this and added my framework to Embedded binaries in on General tab. It also appeared in Linked Frameworks and Libraries section.
General tab with added framework
Seems to be enough, but now I get a buildtime error:
Ld /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug/DehancerNavigationTestUsageProject.app/Contents/MacOS/DehancerNavigationTestUsageProject normal x86_64
cd /Users/yefim/Documents/Projects/DehancerNavigationTestUsageProject
export MACOSX_DEPLOYMENT_TARGET=10.13
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -L/Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug -F/Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug -filelist /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject.LinkFileList -Xlinker -rpath -Xlinker #executable_path/../Frameworks -mmacosx-version-min=10.13 -Xlinker -object_path_lto -Xlinker /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -add_ast_path -Xlinker /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject.swiftmodule -framework DehancerNavigation -Xlinker -dependency_info -Xlinker /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Intermediates.noindex/DehancerNavigationTestUsageProject.build/Debug/DehancerNavigationTestUsageProject.build/Objects-normal/x86_64/DehancerNavigationTestUsageProject_dependency_info.dat -o /Users/yefim/Library/Developer/Xcode/DerivedData/DehancerNavigationTestUsageProject-eqegtcmqsajracgiyxgidupllvbp/Build/Products/Debug/DehancerNavigationTestUsageProject.app/Contents/MacOS/DehancerNavigationTestUsageProject
ld: framework not found DehancerNavigation
clang: error: linker command failed with exit code 1 (use -v to see invocation).
Is there something else I need to setup to use framework in project?
Problem solved when I copied framework to my project folder instead of making a reference to it (copy items if needed checker should be set).
When I try to build my Xcode project this error comes up:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It is really frustrating because I cannot get rid of it. It shows up in my normal target and my test target. Please help.
The full error is below thanks.
Ld /Users/callumbondy/Library/Developer/Xcode/DerivedData/Dotcha!-ajrirvxbqfcklkfaxgrfgwslckom/Build/Products/Debug-iphonesimulator/Dotcha!.app/Dotcha! normal i386
cd "/Users/callumbondy/Desktop/Desktop/Projects/Dotcha!"
export IPHONEOS_DEPLOYMENT_TARGET=8.2
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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 i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk -L/Users/callumbondy/Library/Developer/Xcode/DerivedData/Dotcha!-ajrirvxbqfcklkfaxgrfgwslckom/Build/Products/Debug-iphonesimulator -L/Applications/Adobe\ Flash\ CC\ 2014/AIR13.0/lib/aot/stub -F/Users/callumbondy/Library/Developer/Xcode/DerivedData/Dotcha!-ajrirvxbqfcklkfaxgrfgwslckom/Build/Products/Debug-iphonesimulator -filelist /Users/callumbondy/Library/Developer/Xcode/DerivedData/Dotcha!-ajrirvxbqfcklkfaxgrfgwslckom/Build/Intermediates/Dotcha!.build/Debug-iphonesimulator/Dotcha!.build/Objects-normal/i386/Dotcha!.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/callumbondy/Library/Developer/Xcode/DerivedData/Dotcha!-ajrirvxbqfcklkfaxgrfgwslckom/Build/Intermediates/Dotcha!.build/Debug-iphonesimulator/Dotcha!.build/Objects-normal/i386/Dotcha_.swiftmodule -mios-simulator-version-min=8.2 -framework StoreKit -framework iAd -framework GameKit -Xlinker -dependency_info -Xlinker /Users/callumbondy/Library/Developer/Xcode/DerivedData/Dotcha!-ajrirvxbqfcklkfaxgrfgwslckom/Build/Intermediates/Dotcha!.build/Debug-iphonesimulator/Dotcha!.build/Objects-normal/i386/Dotcha!_dependency_info.dat -o /Users/callumbondy/Library/Developer/Xcode/DerivedData/Dotcha!-ajrirvxbqfcklkfaxgrfgwslckom/Build/Products/Debug-iphonesimulator/Dotcha!.app/Dotcha!
ld: warning: ignoring file /Applications/Adobe Flash CC 2014/AIR13.0/lib/aot/stub/libSystem.dylib, file was built for armv7 which is not the architecture being linked (i386): /Applications/Adobe Flash CC 2014/AIR13.0/lib/aot/stub/libSystem.dylib
ld: in '/Applications/Adobe Flash CC 2014/AIR13.0/lib/aot/stub/libobjc.A.dylib', file was built for armv7 which is not the architecture being linked (i386): /Applications/Adobe Flash CC 2014/AIR13.0/lib/aot/stub/libobjc.A.dylib for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The library libobjc.A.dylib that you are using don't have an i386 architecture slice. You probably is getting this error when running the app on simulator right?
Compile using a compatible version of your library or try to run on a real device to see if it resolves your problem.
my project blows up with this message:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I cannot figure out what I am doing wrong. I've taken out all of the offending code (i think), and I've even deleted everything back to the original classes, but I still get the messages.
Any suggestions?
Thanks.
here's the entire log:
Ld /Users/xxxx/Library/Developer/Xcode/DerivedData/NewTest-gwytsbxrryxjejdbvifxuyomdpug/Build/Products/Debug-iphonesimulator/NewTest.app/NewTest normal i386
cd "/Users/xxxx/Desktop/NewTest copy"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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 i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/xxxx/Library/Developer/Xcode/DerivedData/NewTest-gwytsbxrryxjejdbvifxuyomdpug/Build/Products/Debug-iphonesimulator -F/Users/xxxx/Library/Developer/Xcode/DerivedData/NewTest-gwytsbxrryxjejdbvifxuyomdpug/Build/Products/Debug-iphonesimulator -filelist /Users/xxxx/Library/Developer/Xcode/DerivedData/NewTest-gwytsbxrryxjejdbvifxuyomdpug/Build/Intermediates/NewTest.build/Debug-iphonesimulator/NewTest.build/Objects-normal/i386/NewTest.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/xxxx/Library/Developer/Xcode/DerivedData/NewTest-gwytsbxrryxjejdbvifxuyomdpug/Build/Products/Debug-iphonesimulator/NewTest.app/NewTest
ld: duplicate symbol _OBJC_IVAR_$_ViewController.testprop3 in /Users/xxxx/Library/Developer/Xcode/DerivedData/NewTest-gwytsbxrryxjejdbvifxuyomdpug/Build/Intermediates/NewTest.build/Debug-iphonesimulator/NewTest.build/Objects-normal/i386/OtherClass.o and /Users/xxxx/Library/Developer/Xcode/DerivedData/NewTest-gwytsbxrryxjejdbvifxuyomdpug/Build/Intermediates/NewTest.build/Debug-iphonesimulator/NewTest.build/Objects-normal/i386/ViewController.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Duplicate symbol _OBJC_IVAR_$_ViewController.testprop3 in /Users/xxxx/Library/Developer/Xcode/DerivedData/NewTest-gwytsbxrryxjejdbvifxuyomdpug/Build/Intermediates/NewTest.build/Debug-iphonesimulator/NewTest.build/Objects-normal/i386/OtherClass.o and /Users/xxxx/Library/Developer/Xcode/DerivedData/NewTest-gwytsbxrryxjejdbvifxuyomdpug/Build/Intermediates/NewTest.build/Debug-iphonesimulator/NewTest.build/Objects-normal/i386/ViewController.o for architecture i386
It appears that you have double defined testprop3.
I know that this question had been asked many times, but every answer seems different. I have built my project and tried to run it, but I get this error:
Ld "/Users/******/Library/Developer/Xcode/DerivedData/Cypher_Bot-dxylepzskcnrtybprtuaotmycjjo/Build/Products/Debug-iphonesimulator/Cypher Bot.app/Cypher Bot" normal i386
cd "/Users/******/Xcode/iOS/Cypher Bot/Universal/Cypher Bot/Cypher Bot"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/********/Library/Developer/Xcode/DerivedData/Cypher_Bot-dxylepzskcnrtybprtuaotmycjjo/Build/Products/Debug-iphonesimulator -F/Users/**********/Library/Developer/Xcode/DerivedData/Cypher_Bot-dxylepzskcnrtybprtuaotmycjjo/Build/Products/Debug-iphonesimulator -filelist "/Users/*******/Library/Developer/Xcode/DerivedData/Cypher_Bot-dxylepzskcnrtybprtuaotmycjjo/Build/Intermediates/Cypher Bot.build/Debug-iphonesimulator/Cypher Bot.build/Objects-normal/i386/Cypher Bot.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework Security -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -o "/Users/********/Library/Developer/Xcode/DerivedData/Cypher_Bot-dxylepzskcnrtybprtuaotmycjjo/Build/Products/Debug-iphonesimulator/Cypher Bot.app/Cypher Bot"
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MFMailComposeViewController", referenced from:
objc-class-ref in CryptoMainViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I also get this right below the message above:
What does this mean? What do I do to fix it?
The error means that the linker can't find the class definition for MFMailComposeViewController. That class is defined in the MessageUI framework. Did you add the MessageUI framework to your target? If you don't know how to do that, read this: How to "add existing frameworks" in Xcode 4?