1. A file with the same name in the project (may be the same as the name of the other library if you write 2)
See if there are any files of the same name in the project. This problem will appear in beginners or write a project too many people, beginners sometimes rush, the file name is repeated, and write code too much, have their own packaged code, are directly to use, It may be duplicated with the file name of the current project. This is more likely to happen for us to write outsourced projects. Some specific modules, such as login, share, and so on, are encapsulated modules. It is possible to duplicate a local file when it is used directly in the project. All must be clear and unique in the project .
2. Link error.If your project only defines a file of this name, check the project targets bulid phases, in Complie sources is not compiled two times
3. Repeat the import issue.
This problem is seldom committed because everyone is used to importing. And import will only be quoted once. The use of include will add ifdef because there is a duplicate import problem
4. Specific code spelling error
today made a very basic mistake, is about the use of some keywords in C language. You want to define some fixed strings for others to use.
The error code is as follows:
Declared in the. h file:
NSString * Const Rwserverapiputalarmpath
Implemented in the. m file:
NSString * Const Rwserverapiputalarmpath = @ "http://*********" ;
This type of writing does not go wrong while the project is running, but the error occurs when a static library is used for others. This definition differs from the definition of a property, where the property simply sets its Getter property, and for such a declaration, you want to add a header file that is defined in another file.The extern keyword tells the compiler that I have defined it here, but I'm going to do it somewhere else.
Correct code:
The. h file
externnsstring *const rwserverapiputalarmpath;
implemented in the. m file:
NSString * Const Rwserverapiputalarmpath = @ "http://*********" ;
IOS Duplicate symbol Error