Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linker command failed with exit code 1 (use -v to see invocation) in Swift

Tags:

xcode

ios

swift

I used Swift language in my IOS application project in Xcode6 Beta6 and then I had to work on it with another computer. Then I got this error:

"clang: error: linker command failed with exit code 1 (use -v to see invocation)"

This error is shown only different computers than the computer on which I opened my project at first. It does not give an error in the first computer (which I opened and started to the project)

I tried to clean, and delete the contents of DerivedData folder, but it gives me the same error again. Below this error, it also says that "file not found:" for inside of the DerivedData folder:

file not found: /Users/macbook/Library/Developer/Xcode/DerivedData/SihirliSayilar-gmmsqkhqgygosqeuqdiibnrjasbq/Build/Products/Debug-iphonesimulator/Project.app/Project

I looked the other titles for this issue, but none of them solve this problem. Thank you for any help!

like image 570
simge Avatar asked Aug 27 '14 10:08

simge


2 Answers

The fact that it's a linker error should point you into the right direction. Compilation errors usually mean an error in your syntax. Linker error means that although your source files have been compiled correctly, but when the time comes to be linked with other frameworks (system frameworks, or 3rd party ones), clang cannot find them in place.

Usually, this is because a 3rd party library is missing from your system, and your project depends on it, and although it can find the header files, it cannot find the actual library file to connect to. The fact that transferring your project to other computers is giving you problems, while at your computer compiles and links correctly also strengthens the assumption that probably it's a problem with the environment you are trying to compile with and you need to install something.

To find out more about the issue, go into Xcode, go into the report navigator, and you will see logs of all the builds you have made. Check the first one (which is the last build). Scroll to the bottom, and see exactly why it didn't compile. The most common scenario is that some symbol could not be found. Check in which library this symbol belongs, then install this library to your system.

like image 108
csotiriou Avatar answered Oct 16 '22 00:10

csotiriou


I got same error you have mentioned. I have just clean the project and build it. It worked!

You can clean the project in Product Tab and select clean. To build select build in product tab in Xcode.

like image 31
Rahul Akula Avatar answered Oct 15 '22 22:10

Rahul Akula