什么是clang等效于--no-undefined gcc标志? [英] What is clang's equivalent to --no-undefined gcc flag?
问题描述
我正在尝试使用clang在Mac OS X上构建项目,并且在与ld: unknown option: --no-undefined
链接的步骤上失败,该链接旨在使用gcc进行构建.
此选项对应的clang值是多少? (请不要建议使用gcc而不是clang.)
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.)
还有一个更笼统的问题,是否有任何资源可以找到gcc和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?
谢谢.
推荐答案
OS X使用不同的链接器.正如@rubenvb指出的那样,它可能是来自 Apple的binutils 中的一个.如果运行man ld
,并搜索"undefined",则会找到此选项:
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:
-未定义的处理 指定如何处理未定义的符号.选项包括:错误,警告,禁止或dynamic_lookup.默认值为错误.
-undefined treatment Specifies how undefined symbols are to be treated. Options are: error, warning, suppress, or dynamic_lookup. The default is error.
因此,将-Wl,--no-undefined
替换为-Wl,-undefined,error
.另外,请使用卢克原力".
So, replace -Wl,--no-undefined
with -Wl,-undefined,error
. Also, use the Force, Luke.
这篇关于什么是clang等效于--no-undefined gcc标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!