Xcode compilation undefined symbols for architecture XXX Error Summary

Source: Internet
Author: User

Every time you encounter this kind of mistake headache, do not know how many brain cells to kill, do a summary here

You may encounter these kinds of errors:
Undefined Symbols for Architecture armv7
Undefined Symbols for Architecture armv7s
Undefined Symbols for Architecture arm64
Undefined Symbols for Architecture i386
Undefined Symbols for Architecture x86_64

Error Cause Analysis
1, most of the situation is to forget to add a system framework or dylib bar, such as you use Sqlite3 in the project, but did not add libsqlite3.dylib, this problem will occur. The solution is to add the corresponding framework or dylib.
2, if the C function is called in C + +, check if there is an extern "C", this can be determined by observing the function name in the error hint, if the C function is called in C + +, you need to add extern "C".
3. If the xcodeproj file of other projects is added to the current project, check that the target dependencies in build phases has no dependency, and the linked frameworks and Libraries there are no associated. a files added.
4, if Add. A file compile error-free and add xcodeproj file compilation errors can refer to 3
5, if you add. A file compilation error, first check whether its corresponding header file is added correctly, or in build setting to add the corresponding header Search path path; second, check the C + + compilation options for the. A file are consistent with the C + + compilation options for the current project And finally check if the. A file is consistent with the current project's CPU schema information
6, if the extern variable is reported this error, to check whether the extern variable is declared elsewhere, if not, add; If the external variable is in a static library, the search path is correct based on 5 to check the reference header file or header file, or if there is no problem with the header file, You need to check whether the static library is consistent with the CPU schema information of the current project
7, if the static library is used, the real Machine debug test is normal, and in the implementation of the for IOS device test times This error, it is likely because the static library support of the schema is not complete. This occurs when build Active Architecture in Build setting is set to Yes under Debug, which makes the true machine Debug test normal.


Check the CPU schema support commands for the static library:
Lipo-info xxxxx.a

find a static library that does not support arm64
Find. -name *.a-exec lipo-info "{}" \;

prompt for expected} Error resolution at @end
The problem is obviously that there is a problem with the match. If the code is very easy to find, if the code a lot how to narrow the search scope? In general, this problem is accompanied by another error: "Use of undeclared identifire ' SomeMethod '" is indicated at a function definition, so there is one less place before this function definition, causing the compiler to mistake the function definition as a function call.

Xcode compilation undefined symbols for architecture XXX 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.