构建qt项目时"没有这样的sysroot目录"

Ars*_*nov 4 macos xcode qt

MacOS Mojave版本10.14(18A389).

今天我将Xcode更新为10.0版(10A255).当我尝试构建我的Qt项目时,我收到一个错误:

clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk' [-Wmissing-sysroot]
In file included from ../greed/timediagram.cpp:1:
In file included from ../../../Qt/5.9.1/clang_64/lib/QtGui.framework/Headers/QtGui:3:
In file included from /Users/arsenyspiridonov/Qt/5.9.1/clang_64/lib/QtGui.framework/Headers/QtGuiDepends:3:
In file included from /Users/arsenyspiridonov/Qt/5.9.1/clang_64/lib/QtCore.framework/Headers/QtCore:4:
In file included from ../../../Qt/5.9.1/clang_64/lib/QtCore.framework/Headers/qglobal.h:47:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/utility:202:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:61:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h:61:15: fatal error: 'string.h' file not found
#include_next <string.h>
              ^~~~~~~~~~
1 error generated.
make: *** [timediagram.o] Error 1
16:13:47: ??????? «/usr/bin/make» ?????????? ? ????? 2.
?????? ??? ??????/????????? ??????? greed (????????: Desktop Qt 5.9.1 clang 64bit)
?? ????? ?????????? ????? «??????»
Run Code Online (Sandbox Code Playgroud)

有什么问题?怎么解决?

小智 6

将'QMAKE_MAC_SDK = macosx10.14'添加到.pro文件中,并从构建目录(或目录)中手动删除.qmake.stash.

  • 从Sierra-&gt; Mojave升级后,只需从我的debug和release构建目录中删除.qmake.stash即可解决问题,无需进行.pro编辑。 (3认同)