2014-01-17 67 views
0

我想在Mac OS X 10.9下使用xcrun構建現有的應用程序。該應用程序與libxml集成。它配備了包括如:xcrun:如何添加到標題搜索路徑?

#include <libxml/parser.h> 

爲了測試,我跑:

echo '#include <libxml/parser.h>' | xcrun clang -xc -v - 

這給了我

#include "..." search starts here: 
#include <...> search starts here: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/include 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks (framework directory) 
End of search list. 
<stdin>:1:10: fatal error: 'libxml/parser.h' file not found 
#include <libxml/parser.h> 

雖然臨界頭搜索路徑xcrun下顯得起來,libxml2的是失蹤。作爲事實上,libxml的/ *^h居住在

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include 

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2 

一個子目錄我如何添加這個目錄(.../usr/include目錄/ libxml2的)到搜索路徑尊重xcrun

+0

我應該說:我想通過命令行添加它,最好。 – mrcalvin

回答

0

單擊項目導航器頂部的項目,然後確保選擇了合適的目標。在屏幕頂部中心點擊「Build Settings」。現在進入「搜索路徑」一節,找到要編輯的路徑(例如框架搜索路徑,標題搜索路徑,庫搜索路徑)。將有多個列,因爲您可以在項目級別,xcconfig文件中,目標級別等配置這些變量,並且篩選出的最終值顯示在「已解決」列中。選擇適合您的任何級別,然後雙擊該字段並鍵入您的路徑。

注意:如果您的路徑有空格,則應將其用雙引號括起來;但是,目前在Xcode中存在一個錯誤,它會導致Xcode偶爾重新解釋搜索路徑字符串並雙重轉義它們。所以,當你輸入「my/path/here」時,Xcode將它存儲爲「my/path/here」,這是正確的。但後來Xcode可能會將其存儲爲\\「my/path/here \\」,這意味着Xcode會嘗試從導致失敗的「my/path/here \」中提取文件。所以,如果這種收穫只是擺脫雙重逃跑。

+0

謝謝你的逐步解釋!我將如何在所有項目和命令行中實現該目標(在運行xcrun之前或之前)? – mrcalvin

+0

不幸的是我沒有足夠的經驗在命令行來幫助你。 :( – bgfriend0

相關問題