Appears (linker command failed with exit code 1) Error Summary
This problem usually occurs when you add a third-party library file or when you develop multiple people.
This problem is usually a link error that is caused by a file not being found. We can proceed from the following aspects of the investigation.
1. Take the following error as an example, if you are a multi-person developer, you will find the following error when you complete the synchronization.
[HTML] view Plaincopy
Undefined Symbols for Architecture armv7:
"_objc_class_$_mypagelogviewcontroller", referenced from:
Objc-class-ref in BAIDUMOBSTATAPPDELEGATE.O
Ld:symbol (s) not found for architecture armv7
Clang:error:linker command failed with exit code 1 (use-v to see invocation)
The "Mypagelogviewcontroller" class appears in the error, and you can find the. m file for this class and see his target membeship, as
If it is not checked, click on the check box. And then compile the view.
2. If it is a newly added third-party library and is not a static library
Repeat the first step and then find the Build settings->linking->other Linker Flags
Modify this property to-all_load or-OBJC, depending on the situation. In short, you can try more than a few times.
At this point we need to set the link flag in Project info, add-all_load, which will link all existing symbol;
3. If you are adding a third-party static library (. a file)
[HTML] view Plaincopy
Undefined Symbols for Architecture armv7:
"_objc_class_$_baidumobstat", referenced from:
Objc-class-ref in BAIDUMOBSTATAPPDELEGATE.O
Objc-class-ref in MYPAGELOGVIEWCONTROLLER.O
(Maybe you meant: _objc_class_$_baidumobstatappdelegate)
Ld:symbol (s) not found for architecture armv7
Clang:error:linker command failed with exit code 1 (use-v to see invocation)
Errors have occurred in all files used in this library, such as the Baidumobstatappdelegate class and the Mypagelogviewcontroller class
This could be a link error caused by this static library path confusion.
Workaround: Build settings->search path->library Search Paths Add the appropriate path to the static library. Such as
If none of the above methods works. You can try a few more ways:
1 to see if there is a newly added file with the same name as the previous file
2, the error message appears in the name of a class, go to the original file to see what the third-party library, the library #import, find out the wrong library, and then follow the official steps to re-add again.
Today, I encountered the "linker command failed with exit code 1 (use-v to see invocation)" Question,
What makes me depressed is that Xcode doesn't point out the code for a specific error, which makes it more difficult for a novice to find a problem,
Here's a summary of the mistakes I've encountered:
1. Images that are linked or used in Storyboard do not exist.
Solution: Remove the images used in the storyboard.
2. The defined class name coincides with the name of the picture (this also makes me not realize that the picture name and the class name are not the same).
FIX: Modify two names to a different name, or temporarily comment out the class name to compile successfully.
I'm probably used to the simple and beautiful syntax in. NET, to objetive-c this way, how to look at the code is not beautiful, no beauty, no longer like in. NET write code A word value of the feeling of the daughter.
3. The third-party library that is used. A file does not exist locally.
WORKAROUND: I: Locate the Library and re-add the reference.
II: Temporarily comment out the code for the library call, you can compile the pass.
Appears (linker command failed with exit code 1) Error Summary