2013-09-26 36 views
2

我得到在Xcode編譯時錯誤,其中包括此消息如何獲得對Xcode「clang」編譯時錯誤的調用?

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

-v顯然是一個命令行選項。我之前遇到過這個消息,並一直對我能做些什麼以及爲什麼包含這些信息感到遺憾,如果我對此無能爲力。

如何在Xcode中使用該選項來查看調用?

+0

問題的標題是錯誤的:這是鏈接時錯誤,而不是編譯時錯誤。 – oromoiluig

回答

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 
+0

感謝您的回覆。我在Build Settings> Linking下找到了這個字段並添加了「-v」,但沒有喜悅。 – JohnK

+0

或者說我應該說它給了我更多(不明顯有用)的信息,並且仍然給出相同的clang錯誤消息(就好像我沒有調用'-v')。 – JohnK

+0

我剛剛在這裏做了一個測試,並得到了鏈接器的調用;也許你的情況有所不同。 –