(Linker command failed with exit code 1) Error summary, linkerfailed

Source: Internet
Author: User

(Linker command failed with exit code 1) Error summary, linkerfailed

This problem usually occurs when a third-party library file or multiple developers are added.

This problem is generally caused by a link error because the file cannot be found. We can troubleshoot from the following aspects.

 

1. Take the following error as an example. If it is developed by multiple people, you will find the following error after synchronization is completed.

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 is displayed in the error. You can find the. m file of this class and view its Target Membeship, as shown in figure

 

If not selected, click it. Then compile and view.

 

2. If it is a newly added third-party library and is not a static library

Repeat the first step and find Build settings> Linking> Other Linker Flags.

Modify this attribute to-all_load or-ObjC, depending on the situation. In short, you can try multiple times.

 

3. If a third-party static library (. a file) is added)

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 occur in all files used in this library, such as the BaiduMobStatAppDelegate class and MyPageLogViewController class.

 

In this case, the Link error may be caused by the path confusion of the static library.

Solution: Build settings-> Search Path-> Library Search Paths to add the corresponding Path of the static Library. For example

 

If none of the above methods are used. You can try the following methods:

1. Check whether the newly added file has the same name as the previous file.

2. The error message contains the name of a class. Go to the original file and check # which third-party libraries have been imported. Comment out these libraries one by one and find the database with the error, then, follow the official steps to add it again.

 

Related Article

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.