16 10 月, 2016

Xcode升级后导致原Qt项目构建失败的问题

原有使用Qt Creator 4.0.2创建的跨平台GUI项目,在近日Xcode升级至8.0后,出现了构建失败的问题,错误信息如下:

clang: warning: no such sysroot directory: ‘/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk’
In file included from ../FbxVertexMerger/main.cpp:1:
In file included from ../FbxVertexMerger/mainwindow.h:4:
In file included from ../../../../Qt5.7.0/5.7/clang_64/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from ../../../../Qt5.7.0/5.7/clang_64/lib/QtWidgets.framework/Headers/qmainwindow.h:43:
In file included from /Users/wzkres/Qt5.7.0/5.7/clang_64/lib/QtWidgets.framework/Headers/qwidget.h:43:
In file included from /Users/wzkres/Qt5.7.0/5.7/clang_64/lib/QtGui.framework/Headers/qwindowdefs.h:43:
In file included from /Users/wzkres/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qglobal.h:81:
/Users/wzkres/Qt5.7.0/5.7/clang_64/lib/QtCore.framework/Headers/qsystemdetection.h:95:12: fatal error: ‘TargetConditionals.h’ file not found
# include <TargetConditionals.h>

显然,问题出在MacOSX10.11.sdk这个位置,升级后的MacOSX SDK变为了MacOSX10.12.sdk,那么如何让Qt使用新版本的SDK呢?很简单,修改Qt项目的.pro文件,加入 Continue reading…