0
votes

I am trying to run and test my app in Xcode 8.2.1, but I am getting this error. I've been searching around, but cannot find an answer that works for my problem. What could be the culprit here?

duplicate symbol _randomPositionY in: /Users/tetadickens/Library/Developer/Xcode/DerivedData/Stealth_Crash-gbxbrdfgfsyxnkafhbmltuvxvsvz/Build/Intermediates/Stealth Crash.build/Debug-iphonesimulator/Stealth Crash.build/Objects-normal/x86_64/ViewController.o /Users/tetadickens/Library/Developer/Xcode/DerivedData/Stealth_Crash-gbxbrdfgfsyxnkafhbmltuvxvsvz/Build/Intermediates/Stealth Crash.build/Debug-iphonesimulator/Stealth Crash.build/Objects-normal/x86_64/AppDelegate.o duplicate symbol _Y in: /Users/tetadickens/Library/Developer/Xcode/DerivedData/Stealth_Crash-gbxbrdfgfsyxnkafhbmltuvxvsvz/Build/Intermediates/Stealth Crash.build/Debug-iphonesimulator/Stealth Crash.build/Objects-normal/x86_64/ViewController.o /Users/tetadickens/Library/Developer/Xcode/DerivedData/Stealth_Crash-gbxbrdfgfsyxnkafhbmltuvxvsvz/Build/Intermediates/Stealth Crash.build/Debug-iphonesimulator/Stealth Crash.build/Objects-normal/x86_64/AppDelegate.o duplicate symbol _randomPositionX in: /Users/tetadickens/Library/Developer/Xcode/DerivedData/Stealth_Crash-gbxbrdfgfsyxnkafhbmltuvxvsvz/Build/Intermediates/Stealth Crash.build/Debug-iphonesimulator/Stealth Crash.build/Objects-normal/x86_64/ViewController.o /Users/tetadickens/Library/Developer/Xcode/DerivedData/Stealth_Crash-gbxbrdfgfsyxnkafhbmltuvxvsvz/Build/Intermediates/Stealth Crash.build/Debug-iphonesimulator/Stealth Crash.build/Objects-normal/x86_64/AppDelegate.o ld: 27 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

EDIT

This issue started after I went to Editor > Validate Settings.

2

2 Answers

0
votes

As the compiler has said, there are multiple definitions of the randomPositionY in your code. It is okay if you declare the function in a header file but you may not have multiple implementations of a function. After all, how can the compiler know which implementation should be executed when the function is called?

0
votes

There are 27 duplicate symbol found in your code, randomposition_y, randomposition_x, symbol_y etc. My guess by showing your error that you use these variables in appdelegate and in your viewcontroller. Rename these variables will solve your error.