IOS Duplicate symbol Error

Source: Internet
Author: User

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

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.