2

我在 Xcode 中收到包含此消息的编译时错误

clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

-v显然是一个命令行选项。我之前遇到过这条消息,并且一直不知道我能做些什么,以及如果我对此无能为力,为什么它会被包含在内。

如何使用 Xcode 中的选项来查看调用?

4

1 回答 1

4

您可以添加-v到项目设置中的“其他链接器标志”字段。在此处的测试项目中这样做会产生完整的链接器调用:

 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
 -demangle
 -dynamic
 -arch x86_64
 -macosx_version_min 10.8.0
 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
 -o /Users/carl/Library/Developer/Xcode/DerivedData/example-ewesimyvcwmjptdwzbkqoasrcppe/Build/Products/Debug/example
 -L/Users/carl/Library/Developer/Xcode/DerivedData/example-ewesimyvcwmjptdwzbkqoasrcppe/Build/Products/Debug
 -filelist /Users/carl/Library/Developer/Xcode/DerivedData/example-ewesimyvcwmjptdwzbkqoasrcppe/Build/Intermediates/example.build/Debug/example.build/Objects-normal/x86_64/example.LinkFileList
 -dependency_info /Users/carl/Library/Developer/Xcode/DerivedData/example-ewesimyvcwmjptdwzbkqoasrcppe/Build/Intermediates/example.build/Debug/example.build/Objects-normal/x86_64/example_dependency_info.dat
 -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a
 -F/Users/carl/Library/Developer/Xcode/DerivedData/example-ewesimyvcwmjptdwzbkqoasrcppe/Build/Products/Debug
于 2013-09-26T15:15:14.230 回答