Appears (linker command failed with exit code 1) Error Summary

Source: Internet
Author: User

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

  1. Undefined Symbols for Architecture armv7:

  2. "_objc_class_$_mypagelogviewcontroller", referenced from:

  3. Objc-class-ref in BAIDUMOBSTATAPPDELEGATE.O

  4. Ld:symbol (s) not found for architecture armv7

  5. 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

  1. Undefined Symbols for Architecture armv7:

  2. "_objc_class_$_baidumobstat", referenced from:

  3. Objc-class-ref in BAIDUMOBSTATAPPDELEGATE.O

  4. Objc-class-ref in MYPAGELOGVIEWCONTROLLER.O

  5. (Maybe you meant: _objc_class_$_baidumobstatappdelegate)

  6. Ld:symbol (s) not found for architecture armv7

  7. 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

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.