What is clang's equivalent to --no-undefined gcc flag?

三世轮回 提交于 2020-01-01 05:03:11

问题


I am trying to build a project on Mac OS X using clang and it fails on linking step with ld: unknown option: --no-undefined, which is meant to built with gcc. What's the clang equivalent for this option? (Please, don't advise to use gcc instead of clang.)

Also, a more generic question, is there any resource where one can find some kind of a "mapping" between gcc and clang (linker) options differences?

Thank you.


回答1:


OS X uses a different linker. As @rubenvb points out, it's probably the one from Apple's binutils. If you run man ld, and search for "undefined", you will find this option:

-undefined treatment Specifies how undefined symbols are to be treated. Options are: error, warning, suppress, or dynamic_lookup. The default is error.

So, replace -Wl,--no-undefined with -Wl,-undefined,error. Also, use the Force, Luke.



来源:https://stackoverflow.com/questions/26971333/what-is-clangs-equivalent-to-no-undefined-gcc-flag

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