I am working on a program on Xcode, however, I have gotten the following two err
ID: 3828867 • Letter: I
Question
I am working on a program on Xcode, however, I have gotten the following two error messages which I have attached as a screenshot below. Can someone please help me out on how to resolve those error messages?
Lab session 12 5 issues Unused Entity lssue Unused variable 'Drone1 main.c Semantic Issue mplicit declaration of function oa' is invalid in C99 main.c Value Conversion Issue mplicit conversion loses intege met' (aka 'long') to precision unsigned int main.c 9 Apple Mach-O Linker (ld) Error referenced from Oa Linker command failed with exit code use -v to see invocation v a/Desktop/Program XCode/practice coding/Lab session 12/Lab session 12 Compile main.c n /Users/joseantoniopol Unused variable "Drone Implicit declaration of function 'itoa s invalid in C99 Implicit conversion loses integer precision: "time t' aka 'long to 'unsigned in Link /Users/joseantoniopo session 12-bexgdefsbklpmpdjkzkdewzwwxjv/Build/Pro O2 Ld /Users/joseantonioportilla/Library/Developer/Xcode/DerivedData/Lab session 12 bexgdefsbklpmpdjkzkdewzwvxjv/Build/Products/Debug/LabV session 12 normal x86 64 cd "/Users/joseantonioportilla/Desktop/Program XCode/practice coding/Lab session 12" port MACOSX DEPLOYMENT TARGET 10. 12 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoo uchain/usr/bin/clang -arch x86-64 -isysroot /Applications/Xcode. app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs MacOSX10. 12. sdk -L/Users/joseantonioportilla/Library/Developer/Xcode/DerivedData/Lab session 12 bexgdefsbklpmpdjkzkdewzwwxj v/Build/Products/Debug F/Users/joseantonioportilla/Library/Developer/Xcode/ Derived Data/Lab session 12-bexgdefsbkupmpdjkzkdewzwwxjv/Build/Products/Debug -filelist /Users joseantonioportilla/Library/Developer/Xcode/DerivedData/Lab session 12-bexgdefsbklpmpdjkzkdewzwvxjv Build/Intermediates/LabV sessionA 12. build/Debug/Lab session 12.build/0bjects-normal/x86 64/LabA session 12. LinkFileL mmacosx-version-min 10.12 -Xlinker object path lto -Xlinker /Users/ ist joseantonioportilla/Library/Developer/Xcode/DerivedData/Lab session 12-bexgdefsbklpmpdjkzkdewzwvxjv/ Build/Intermediates/LabV session 12. build/Debug/Labl sessionA 12.build/0bjects-normal/x86 64/LabA session 12 lto.o -Xlinker -export dynamic Xlinker no deduplicate -Xlinker -dependency info linker Users/joseantonioportilla/Library/Developer/Xcode/DerivedData/Lab session 12 bexgdefsbklpmpdjkzkdew zwwxjv/Build/Intermediates/LabV sessionA 12.build/Debug/LabV sessionV 12. build/ Objects-normal/x86 64/LabV session 12 dependency info.dat o /Users/joseantonioportilla/Library/ Developer/Xcode/DerivedData/Lab session 12-bexgdefsbklpmpdjkzkdewzwwxjv/Build/Products/Debug/Lab session 12 Undefined symbols fo r architecture x86 64 itoa", referenced from init VectorDrones in main.o ld: symbol (s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) referenced from s in main Symbol(s) not found for architecture x86 64 9 Linker command failed with exit code 1 (use -v to see invocatio g CompleteExplanation / Answer
Solution:
itoa() is supported in Xcode c99 standard library, so change the statement
itoa(I+1,aux,10) to the statement sprintf(aux,"%d",i+1);
The header file required for sprintf is stdio.h
Next, change the statement srand(time(NULL))
to srand((int)time(NULL)), type casting is needed from long to int
You can also delete the unused variable struct typeDrone Drone1; to silence the warning.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.