(Linker command failed with exit code 1) Error Summary

Source: Internet
Author: User

This can sometimes occur when compiling a tripartite library, usually when you add a third-party library file or when you are developing more than one person.

This problem is generally caused by a link error that cannot be found in the file. We can proceed from the following several aspects of the investigation.


1. Take the following error as an example, if the development of more than one person, you have completed synchronization after the following error found.


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 the invocation)


The "Mypagelogviewcontroller" class appears in the error, and you can find the. m file for this class and view his target membeship, as shown below

If there is no tick, click tick. 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 locate the build Settings->linking->other Linker Flags


Modify this property to-all_load or-OBJC, depending on the situation. In short, you can try a few more times.


3. If you are adding a third party static library (. a file)

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 the 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. The following figure



If none of the above methods works. You can try a few more ways:

1, to see if there are any newly added files 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 which Third-party library #import, the library to exclude each annotation, find the wrong library, and then follow the official steps to add again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.