問題描述
我剛剛安裝了 Qt 5.5 并且第一次在 OS X 上使用 Qt Creator.當我第一次安裝 Qt 時,它給了我一條錯誤消息Xcode 5 not installed",我認為這很奇怪,(我有 Xcode7 測試版),但安裝還是成功完成.
I just installed Qt 5.5 and am using Qt Creator for the first time on OS X. When I first installed Qt, it gave me an error message 'Xcode 5 not installed' which I thought was strange, (I have the Xcode 7 beta), but the install completed successfully anyways.
現在,當我開始或打開一個項目時,出現錯誤:
Now, when I start or open a project, I get the error:
項目錯誤:Xcode 設置不正確.您可能需要通過運行/usr/bin/xcodebuild 來確認許可協議.
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
當我在終端中運行 /usr/bin/xcodebuild
時,我得到以下信息:
When I run /usr/bin/xcodebuild
in Terminal, I get the following:
xcode-select: 錯誤:工具 'xcodebuild' 需要 Xcode,但活動開發者目錄 '/Library/Developer/CommandLineTools' 是命令行工具實例
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
我不確定 Xcode 與 Qt Creator 有什么關系,除非它與訪問庫以實現跨平臺兼容性有關,但有沒有辦法解決這個問題?
I'm not sure what Xcode has to do with Qt Creator, unless it has something to do with accessing libraries for cross-platform compatibility, but is there a way to fix this issue?
推薦答案
>= Xcode 8
在 Xcode 8 中,正如 Bruce 所說,當 Qt 試圖尋找 xcrun
而它應該尋找 xcodebuild
時,就會發生這種情況.
In Xcode 8, as Bruce said, this happens when Qt tries to find xcrun
when it should be looking for xcodebuild
.
打開文件:
Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
替換:
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))
與:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
~>Xcode 8
Xcode 8 之前,在安裝 Xcode 后安裝命令行工具時會出現此問題.發生的事情是 Xcode-select
開發者目錄被指向 /Library/Developer/CommandLineTools
.
Before Xcode 8, this problem occurs when command line tools are installed after Xcode is installed. What happens is the Xcode-select
developer directory gets pointed to /Library/Developer/CommandLineTools
.
使用以下命令將 Xcode-select
指向正確的 Xcode Developer 目錄:
Point Xcode-select
to the correct Xcode Developer directory with the command:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
使用命令確認許可協議:
Confirm the license agreement with the command:
sudo xcodebuild -license
這將提示您通讀許可協議.
This will prompt you to read through the license agreement.
輸入同意
以接受條款.
這篇關于Qt Creator - 項目錯誤:Xcode 設置不正確.您可能需要通過運行/usr/bin/xcodebuild 來確認許可協議的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!