ld: 871 duplicate symbols for architecture armv7, clang: error: linker command failed with exit code 1 (use -v to see invocation)

不问归期 提交于 2019-12-07 15:32:52

问题


I am using FastPDFKit in my iPhone app for displaying PDF. When I run the project on simulator, it works fine. However when I run the project on iPhone, it gives me below error.

duplicate symbol _value_map in:
    /Users/alkandari/Desktop/iPhone Apps/MyTest002/MyTest002/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit)
duplicate symbol _writeUnicodeToUTF8Buffer in:
    /Users/alkandari/Desktop/iPhone Apps/MyTest002/MyTest002/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit)
ld: 871 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: 871 duplicate symbols for architecture armv7


clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any idea why it is happening like this?


Error comes when I add FastPDFFramework in Configuration in Debug and Release section.


回答1:


Here's a solution I found even after messing with the header/framework search paths, rebuilding, etc:

http://support.fastpdfkit.com/discussions/problems/443-i-am-unable-to-link-fastpdfkitembeddedframework

I removed the -all_load linker flag in my project and it compiled successfully. As a warning, make sure removing this flag is appropriate for your project. It was probably placed there for a reason




回答2:


Can you try to clean up the FastPdfKit target and recompile it? It should generate a new framework ex-novo that you then should be able to add to you project, overwriting the one you are using. You can grab the new .embeddedframework in the FastPdfKit project root directory.

These line helped me from the link below.

http://support.fastpdfkit.com/discussions/problems/759-duplicate-symbols-for-architecture-armv7




回答3:


there are another reason this error often happens is accidentally importing the .m file instead of the .h.

it's happened to me :)

link : https://stackoverflow.com/questions/12279622/duplicate-symbols-for-architecture-i386-clang




回答4:


You have too many #include or #import directives in header files for the same things. Move to using @class in headers and only import/include in your .m files.

In all you just need to review where these are and reassess them.




回答5:


I add my solution, as if you follow the readme, it will ask you to do:

Inherit the project options: select the Project an from info tab and configurations line choose **FastPdfKitFramework** from the drop down list;

I replace the FastPdfKitFramework target to None and now it work great.

As it is on the readme file, I never add .a in my project so download the recompile one don't help me as I do not want to restart all integration. I hope it can be helpful for someone.




回答6:


I tries removing -all_loads linker flag, and it worked for me without any problem in the project.



来源:https://stackoverflow.com/questions/15460481/ld-871-duplicate-symbols-for-architecture-armv7-clang-error-linker-command-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!