問(wèn)題描述
我剛剛安裝了 Qt 5.5 并且第一次在 OS X 上使用 Qt Creator.當(dāng)我第一次安裝 Qt 時(shí),它給了我一條錯(cuò)誤消息Xcode 5 not installed",我認(rèn)為這很奇怪,(我有 Xcode7 測(cè)試版),但安裝還是成功完成.
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.
現(xiàn)在,當(dāng)我開(kāi)始或打開(kāi)一個(gè)項(xiàng)目時(shí),出現(xiàn)錯(cuò)誤:
Now, when I start or open a project, I get the error:
項(xiàng)目錯(cuò)誤:Xcode 設(shè)置不正確.您可能需要通過(guò)運(yùn)行/usr/bin/xcodebuild 來(lái)確認(rèn)許可協(xié)議.
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
當(dāng)我在終端中運(yùn)行 /usr/bin/xcodebuild
時(shí),我得到以下信息:
When I run /usr/bin/xcodebuild
in Terminal, I get the following:
xcode-select: 錯(cuò)誤:工具 'xcodebuild' 需要 Xcode,但活動(dòng)開(kāi)發(fā)者目錄 '/Library/Developer/CommandLineTools' 是命令行工具實(shí)例
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
我不確定 Xcode 與 Qt Creator 有什么關(guān)系,除非它與訪問(wèn)庫(kù)以實(shí)現(xiàn)跨平臺(tái)兼容性有關(guān),但有沒(méi)有辦法解決這個(gè)問(wèn)題?
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 所說(shuō),當(dāng) Qt 試圖尋找 xcrun
而它應(yīng)該尋找 xcodebuild
時(shí),就會(huì)發(fā)生這種情況.
In Xcode 8, as Bruce said, this happens when Qt tries to find xcrun
when it should be looking for xcodebuild
.
打開(kāi)文件:
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 后安裝命令行工具時(shí)會(huì)出現(xiàn)此問(wèn)題.發(fā)生的事情是 Xcode-select
開(kāi)發(fā)者目錄被指向 /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
使用命令確認(rèn)許可協(xié)議:
Confirm the license agreement with the command:
sudo xcodebuild -license
這將提示您通讀許可協(xié)議.
This will prompt you to read through the license agreement.
輸入同意
以接受條款.
這篇關(guān)于Qt Creator - 項(xiàng)目錯(cuò)誤:Xcode 設(shè)置不正確.您可能需要通過(guò)運(yùn)行/usr/bin/xcodebuild 來(lái)確認(rèn)許可協(xié)議的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!