2009-09-25 55 views
3

我安裝了Qt並嘗試在QtCreator中構建模板項目(Qt4 Gui應用程序)。我無法弄清楚爲什麼我會收到這些錯誤。無法在Snow Leopard上使用Qt構建

Running build steps for project SourceControl... 
Configuration unchanged, skipping QMake step. 
Starting: /usr/bin/make -w 
make: Entering directory `/Users/jason/SourceControl' 
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.5/mkspecs/macx-g++ -I. -I/Library/Frameworks/QtCore.framework/Versions/4/Headers -I/usr/include/QtCore -I/Library/Frameworks/QtNetwork.framework/Versions/4/Headers -I/usr/include/QtNetwork -I/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/usr/include/QtGui -I/usr/include -I. -I. -F/Library/Frameworks -o main.o main.cpp 
In file included from /Library/Frameworks/QtCore.framework/Headers/qnamespace.h:45, 
from /Library/Frameworks/QtCore.framework/Headers/qobjectdefs.h:45, 
from /Library/Frameworks/QtCore.framework/Headers/qobject.h:47, 
from /Library/Frameworks/QtCore.framework/Headers/qcoreapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/qapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/QApplication:1, 
from main.cpp:1: 
/Library/Frameworks/QtCore.framework/Headers/qglobal.h:297:34: error: AvailabilityMacros.h: No such file or directory 
In file included from /Library/Frameworks/QtCore.framework/Headers/qstring.h:46, 
from /Library/Frameworks/QtCore.framework/Headers/qobject.h:48, 
from /Library/Frameworks/QtCore.framework/Headers/qcoreapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/qapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/QApplication:1, 
from main.cpp:1: 
/Library/Frameworks/QtCore.framework/Headers/qbytearray.h:48:20: error: string.h: No such file or directory 
In file included from /Library/Frameworks/QtCore.framework/Headers/qobject.h:48, 
from /Library/Frameworks/QtCore.framework/Headers/qcoreapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/qapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/QApplication:1, 
from main.cpp:1: 
/Library/Frameworks/QtCore.framework/Headers/qstring.h:60:22: error: string: No such file or directory 
In file included from /Library/Frameworks/QtCore.framework/Headers/qobject.h:50, 
from /Library/Frameworks/QtCore.framework/Headers/qcoreapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/qapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/QApplication:1, 
from main.cpp:1: 
/Library/Frameworks/QtCore.framework/Headers/qlist.h:50:20: error: iterator: No such file or directory 
/Library/Frameworks/QtCore.framework/Headers/qlist.h:51:16: error: list: No such file or directory 
/Library/Frameworks/QtCore.framework/Headers/qlist.h:54:15: error: new: No such file or directory 
In file included from /Library/Frameworks/QtGui.framework/Headers/qbrush.h:47, 
from /Library/Frameworks/QtGui.framework/Headers/qpalette.h:47, 
from /Library/Frameworks/QtGui.framework/Headers/qwidget.h:48, 
from /Library/Frameworks/QtGui.framework/Headers/qmainwindow.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/QMainWindow:1, 
from mainwindow.h:4, 
from main.cpp:2: 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:52:18: error: vector: No such file or directory 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:54:20: error: stdlib.h: No such file or directory 
In file included from /Library/Frameworks/QtCore.framework/Headers/qstring.h:46, 
from /Library/Frameworks/QtCore.framework/Headers/qobject.h:48, 
from /Library/Frameworks/QtCore.framework/Headers/qcoreapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/qapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/QApplication:1, 
from main.cpp:1: 
/Library/Frameworks/QtCore.framework/Headers/qbytearray.h: In function 'uint qstrlen(const char*)': 
/Library/Frameworks/QtCore.framework/Headers/qbytearray.h:68: error: 'strlen' was not declared in this scope 
/Library/Frameworks/QtCore.framework/Headers/qbytearray.h: In function 'int qstrncmp(const char*, const char*, uint)': 
/Library/Frameworks/QtCore.framework/Headers/qbytearray.h:91: error: 'strncmp' was not declared in this scope 
/Library/Frameworks/QtCore.framework/Headers/qbytearray.h: In function 'bool operator==(const QByteArray&, const QByteArray&)': 
/Library/Frameworks/QtCore.framework/Headers/qbytearray.h:502: error: 'memcmp' was not declared in this scope 
In file included from /Library/Frameworks/QtCore.framework/Headers/qobject.h:48, 
from /Library/Frameworks/QtCore.framework/Headers/qcoreapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/qapplication.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/QApplication:1, 
from main.cpp:1: 
/Library/Frameworks/QtCore.framework/Headers/qstring.h: At global scope: 
/Library/Frameworks/QtCore.framework/Headers/qstring.h:65: error: expected initializer before ' QList::fromStdList()': 
/Library/Frameworks/QtCore.framework/Headers/qlist.h:316: error: 'list' was not declared in this scope 
/Library/Frameworks/QtCore.framework/Headers/qlist.h:316: error: 'back_inserter' is not a member of 'std' 
In file included from /Library/Frameworks/QtGui.framework/Headers/qbrush.h:47, 
from /Library/Frameworks/QtGui.framework/Headers/qpalette.h:47, 
from /Library/Frameworks/QtGui.framework/Headers/qwidget.h:48, 
from /Library/Frameworks/QtGui.framework/Headers/qmainwindow.h:45, 
from /Library/Frameworks/QtGui.framework/Headers/QMainWindow:1, 
from mainwindow.h:4, 
from main.cpp:2: 
/Library/Frameworks/QtCore.framework/Headers/qvector.h: At global scope: 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:293: error: expected unqualified-id before ' QVector::fromStdVector()': 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:294: error: 'vector' was not declared in this scope 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:294: error: 'back_inserter' is not a member of 'std' 
/Library/Frameworks/QtCore.framework/Headers/qvector.h: In constructor 'QVector::QVector(int) [with T = QPoint]': 
/Library/Frameworks/QtGui.framework/Headers/qpolygon.h:93: instantiated from here 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:397: error: no matching function for call to 'operator new(long unsigned int, QPoint*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qvector.h: In constructor 'QVector::QVector(int) [with T = QPointF]': 
/Library/Frameworks/QtGui.framework/Headers/qpolygon.h:152: instantiated from here 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:397: error: no matching function for call to 'operator new(long unsigned int, QPointF*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qlist.h: In member function 'void QList::node_construct(QList::Node*, const T&) [with T = QString]': 
/Library/Frameworks/QtCore.framework/Headers/qlist.h:426: instantiated from 'void QList::append(const T&) [with T = QString]' 
/Library/Frameworks/QtCore.framework/Headers/qstringlist.h:70: instantiated from here 
/Library/Frameworks/QtCore.framework/Headers/qlist.h:341: error: no matching function for call to 'operator new(long unsigned int, QList::Node*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qlist.h: In member function 'void QList::node_copy(QList::Node*, QList::Node*, QList::Node*) [with T = QString]': 
/Library/Frameworks/QtCore.framework/Headers/qlist.h:618: instantiated from 'QList& QList::operator+=(const QList&) [with T = QString]' 
/Library/Frameworks/QtCore.framework/Headers/qstringlist.h:85: instantiated from here 
/Library/Frameworks/QtCore.framework/Headers/qlist.h:360: error: no matching function for call to 'operator new(long unsigned int, QList::Node*)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qvector.h: In member function 'void QVector::realloc(int, int) [with T = QPoint]': 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:315: instantiated from 'void QVector::detach_helper() [with T = QPoint]' 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:113: instantiated from 'QVector::QVector(const QVector&) [with T = QPoint]' 
/Library/Frameworks/QtGui.framework/Headers/qpolygon.h:66: instantiated from here 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:444: error: no matching function for call to 'operator new(long unsigned int, QPoint*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:484: error: no matching function for call to 'operator new(long unsigned int, QPoint*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:491: error: no matching function for call to 'operator new(long unsigned int, QPoint*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qvector.h: In member function 'void QVector::realloc(int, int) [with T = QPointF]': 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:315: instantiated from 'void QVector::detach_helper() [with T = QPointF]' 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:113: instantiated from 'QVector::QVector(const QVector&) [with T = QPointF]' 
/Library/Frameworks/QtGui.framework/Headers/qpolygon.h:131: instantiated from here 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:444: error: no matching function for call to 'operator new(long unsigned int, QPointF*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:484: error: no matching function for call to 'operator new(long unsigned int, QPointF*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:491: error: no matching function for call to 'operator new(long unsigned int, QPointF*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qvector.h: In member function 'void QVector::realloc(int, int) [with T = QPainterPath::Element]': 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:315: instantiated from 'void QVector::detach_helper() [with T = QPainterPath::Element]' 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:129: instantiated from 'void QVector::detach() [with T = QPainterPath::Element]' 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:228: instantiated from 'T* QVector::begin() [with T = QPainterPath::Element]' 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:241: instantiated from 'T& QVector::first() [with T = QPainterPath::Element]' 
/Library/Frameworks/QtGui.framework/Headers/qpainterpath.h:370: instantiated from here 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:444: error: no matching function for call to 'operator new(long unsigned int, QPainterPath::Element*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:315: instantiated from 'void QVector::detach_helper() [with T = QPainterPath::Element]' 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:129: instantiated from 'void QVector::detach() [with T = QPainterPath::Element]' 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:228: instantiated from 'T* QVector::begin() [with T = QPainterPath::Element]' 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:241: instantiated from 'T& QVector::first() [with T = QPainterPath::Element]' 
/Library/Frameworks/QtGui.framework/Headers/qpainterpath.h:370: instantiated from here 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:484: error: no matching function for call to 'operator new(long unsigned int, QPainterPath::Element*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
/Library/Frameworks/QtCore.framework/Headers/qvector.h:491: error: no matching function for call to 'operator new(long unsigned int, QPainterPath::Element*&)' 
:0: note: candidates are: void* operator new(long unsigned int) 
make: *** [main.o] Error 1 
make: Leaving directory `/Users/jason/SourceControl' 
Exited with code 2. 
Error while building project SourceControl 
When executing build step 'Make'

回答

3

我不知道,但我想你應該把重點放在第一個錯誤,它說它找不到AvailabilityMacros.h。我認爲這應該在/ usr/include中,但是我猜測這可能不是,因爲你的編譯行清楚地表明它是包含路徑之一。

如果它不在那裏,你可以嘗試通過在命令行上使用find來找出它在哪裏。

find /usr -name AvailabilityMacros.h 

或任何GUI方法可在Mac上(你可以告訴我不熟悉MacOS :))。順便說一句,如果上述find命令什麼也沒有產生,那麼你可以擴大從/usr/的搜索範圍。


在回答您的find結果發佈:

你試圖建立你對MacOSX10.5.sdk應用程序?如果沒有,那麼我不認爲這是你想要的版本。如果您使用10.5 SDK ,那麼您需要將QMAKE_MAC_SDK qmake變量設置爲/Developer/SDKs/MacOSX10.5.sdk。您可以在項目文件中執行此操作,也可以在「項目」 - >「生成步驟」中將其設置爲qmake的其他參數。

+0

我的機器上的/ Developer/SDK中沒有MacOSX10.6.sdk目錄。我希望下載最新版本的Xcode可以解決這個問題。 – titaniumdecoy 2009-09-26 22:20:04

+0

是的,我認爲會的。 – Troubadour 2009-09-26 22:21:42

+0

而且......它的確如此。 – titaniumdecoy 2009-09-26 23:32:47

0

謝謝,Troubadour。我能夠通過添加以下行到我的項目的.pro文件來解決問題:

QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.5.sdk

我寧願築起了Mac OS X 10.6 SDK但在/ Developer /軟件開發工具包沒有這樣的目錄。如果您知道我在哪裏可以找到10.6 SDK,請告訴我。

編輯:更新到最新版本的Xcode後,我能夠從我的項目的.pro文件中刪除上面指出的行,併成功編譯。

+0

設置包含路徑並不是獲取SDK的方法。查看我編輯的答案,瞭解如何針對特定SDK構建的詳細信息。我懷疑這不是你想要做的。我認爲你正試圖在10.6本身上構建你的應用程序。是對的嗎? – Troubadour 2009-09-26 22:05:37

+0

我認爲你在註冊開發者賬戶後從developer.apple.com得到它。 – Troubadour 2009-09-26 22:21:01

相關問題