Duplicate symbol _ OBJC_METACLASS _ $ _ GTMBase64, duplicatesymbol

Source: Internet
Author: User

Duplicate symbol _ OBJC_METACLASS _ $ _ GTMBase64, duplicatesymbol

This problem occurs when you import the framework. I started to think it was a path or something. I was not able to solve the problem. Later, I found the information on the Internet and got it because the reference library was repeatedly defined.

Online Data Query reference

Http://hmifly.blog.163.com/blog/static/128583507201342752241781/

PS: The following is the original article. You have read it!

The project needs to reference both ZBar and QQ authorized logon sdks. Because both use Base64 to process data, XCode compilation reports an error:

Duplicate symbol _ base64_encode in:

... \ Libzbar. a (symbol. o)

... \ TencentOpenAPI (base64.o)

 

It means that _ base64_encode is defined in both databases, and the compiler thinks you have already defined it. As to why the compiler considers repeated definitions, I personally think that the compiler will compile global variables based on their names and will compile the global variables with the same name into the same variables, that is, multiple variables will be compiled into one, the compiler thinks this may cause errors and reminds the user of the errors.

 

Solution:

Reference: http://blog.sina.com.cn/s/blog_4beb28f301012bl6.html

Deleted set building-> other linker flag->-all_load

 

The ios Framework is a shared dynamic library and will not be packaged into the app. Non-system Framework static libraries will be packaged into the app. Therefore, a "Duplicate Symbol" error will occur.
In Build Settings-> Other link flags, delete all-all_load and-force_load. XCode removes "Duplicate Symbol" smartly ".

The following is the ultimate solution strategy obtained from foreign friends. the solution is to modify the Class Library: I'm going to assume that these are two third party libraries that have only provided you with. a files and not the source code. you can use libtool, lipo and ar on the terminal to extract and recombine the files.
To see what ubuntures are in the file:
$ Lipo-info libTapjoy.
Ubuntures in the fat file: libTapjoy. a are: armv6 i386
Then to extract just armv6, for example:
$ Lipo-extract_family armv6-output libTapjoy-armv6.a libTapjoy.
$ Mkdir armv6
$ Cd armv6
$ Ar-x ../libTapjoy-armv6.a
You can then extract the same architecture from the other library into the same directory and then recombine them like so:
$ Libtool-static-o ../lib-armv6.a *. o
And then finally, after you 've done this with each architecture, you can combine them again with lipo:
$ Cd ..
$ Lipo-create-output lib. a lib-armv6.a lib-i386.a
This shoshould get rid of any duplicate symbols, but will also combine the two libraries into one. if you want to keep them separate, or just delete the duplicate from one library, you can modify the process accordingly. this process not only solves the duplicate symbols problem, but also combines the two class libraries into one. If you want to save two different class libraries, you can delete the duplicate part from any class library and modify the process accordingly. Conclusion: After deleting-all_load, the problem is solved!

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.