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.
you can try a few more ways first:
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.
3.SVN or git ignores certain files, such as. o files that have not been updated to view. o files may be red, can be re-added or modified svn (git) Ignore settings
4. Remove the. A file and then drag it back to the project to resolve the issue
5. You may have added files repeatedly (or you may not have checked the Copy items if neded option), it is recommended to remove and re-add
6. The same error will occur when the file name is duplicated in the project
7. "Build Settings", "Enable Bitcode" is set to No because some SDKs do not support Bitcode
8. May be at the time of reference may be written #import "XXXXX.M", if it is changed to #import "XXXXX.h"
9. You may import the SDK only under the real machine to run, the simulator will error!
take the following error as an example, after installing afnetworking through cocoa pods, the following error occurs.
This is the same name as the file in the project because the framework was added before Afnetworking was installed through cocoa pods. Completely removed before the project runs.
if it is multi-person development, you have completed the synchronization and found the following error.
- 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.
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.
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 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.
The case of a library path error:
- The error is as follows, which indicates that the
Library
exception occurred at the time of the query.
"directory not found for option ‘-L/..."
Workaround:
Library Search Paths, Build Setting, Project--targets
Delete the path inside
- The error is as follows, which indicates that the
Framework
exception occurred at the time of the query.
"directory not found for option ‘-F/..."
Workaround:
Build Setting, Framework Search Paths, Project, targets
Delete the path inside
OK, get it done.
1. Framework Search Paths
The search path to the framework () attached to the project .framework bundles
2. Library Search Paths
The search path to the third-party library () attached to the project .a files
, Xcode automatically sets the path to the. A file that is dragged to Xcode.
Xcode appears (linker command failed with exit code 1) Error Summary