1. 程式人生 > >解決MacOS UE4中以C++建立Object出錯(UE4關聯配置Xcode)

解決MacOS UE4中以C++建立Object出錯(UE4關聯配置Xcode)

錯誤資訊1: Xcode installed on this Mac is too old to be used for Metal shader compilation. Falling back to runtime compiled text shaders, which are slower. Please update to latest version of Xcode for best performance. 錯誤資訊2: ERROR: UnrealBuildTool Exception: Invalid SDK MacOSX.sdk, not found in ?library/Developer/CommandLineTools/Plaforms/MacOSX.platform/Developer/SDKs    本機環境: MacOS 10.14.2 UE4 4.21.1 Xcode 10.1   UE4安裝完成後無法關聯Xcode,當然不是版本過舊的問題。 忽略錯誤1後建立C++專案報錯誤2。   直接給出解決方法: (參考此處:
https://answers.unrealengine.com/questions/835919/support-issues-xcode-10-ue4203.html
) 1.開啟Xcode 2.找到Xcode->Preferences 3.在開啟的頁面找到Locations->Command Line Tools 4.此處設定為當前的Xcode 5.重啟UE4 順手截圖:   ——— ——— ——— 附 (上述為根本解決方法,下述僅記錄對錯誤2的歷史處理過程,沒必要看)   (參考此處:
https://apple.stackexchange.com/questions/225558/what-is-the-macosx-sdk-file-where-do-i-find-it
) 原因貌似是新版Xcode相關路徑上有修改。 解決辦法:
1 //建立UE4需要的檢索路徑
2 sudo mkdir -p /Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs
3  
4 //將正確的的檔案路徑連結到如上目錄下
5 sudo ln -s /Applications/Xcode.app/contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk MacOSX.sdk
6 sudo ln -s /Applications/Xcode.app/contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk MacOSX10.14.sdk
  之後成功呼叫Xcode,建立了C++專案。 但出現錯誤提示:“ 無法編譯該專案。您想在Xcode中開啟它嗎?” 在Xcode開啟後可以手動編譯通過。 ——— ——— ———