Невозможно выполнить сборку с помощью Qt на Snow Leopard

Я установил Qt и попытался создать проект шаблона (приложение Qt4 Gui) в QtCreator. Я не могу понять, почему я получаю эти ошибки.

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'

person titaniumdecoy    schedule 25.09.2009    source источник


Ответы (2)


Я не уверен, но думаю, вам следует сосредоточиться на первой ошибке, где говорится, что не удается найти AvailabilityMacros.h. Я думаю, что это должно быть в /usr/include, но я предполагаю, что это, вероятно, не так, поскольку ваша строка компиляции ясно показывает это как один из путей включения.

Если его там нет, вы можете попытаться узнать, где он находится, используя find в командной строке, например.

find /usr -name AvailabilityMacros.h

или любые методы графического интерфейса, доступные на Mac (вы можете сказать, что я не очень хорошо знаком с MacOS :)). Кстати, если приведенная выше команда find ничего не дает, вы можете расширить поиск с /usr до /.


В ответ на вашу публикацию результатов find:

Вы пытаетесь собрать свое приложение для MacOSX10.5.sdk? Если нет, то я не думаю, что это та версия, которая вам нужна. Если вы используете SDK версии 10.5, вам необходимо установить для переменной QMAKE_MAC_SDK qmake значение /Developer/SDKs/MacOSX10.5.sdk. Вы можете либо сделать это в файле проекта, либо установить его в качестве дополнительного аргумента для qmake в Projects->Build steps.

person Troubadour    schedule 26.09.2009
comment
На моей машине нет каталога MacOSX10.6.sdk в /Developer/SDKs. Я надеюсь, что загрузка последней версии Xcode исправит это. - person titaniumdecoy; 27.09.2009

Спасибо, Трубадур. Мне удалось решить проблему, добавив следующую строку в файл .pro моего проекта:

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

Я бы предпочел сборку с Mac OS X 10.6 SDK, но такого каталога нет в /Developer/SDKs. Если вы знаете, где я могу найти SDK 10.6, сообщите мне.

EDIT: После обновления до последней версии Xcode я смог удалить указанную выше строку из файла .pro моего проекта и успешно скомпилировать.

person titaniumdecoy    schedule 26.09.2009
comment
Установка пути включения — это не способ получить доступ к SDK. См. мой отредактированный ответ для получения подробной информации о том, как строить с определенным SDK. Я подозреваю, что это не то, что вы пытаетесь сделать. Я думаю, вы пытаетесь создать свое приложение только на 10.6. Это правильно? - person Troubadour; 27.09.2009
comment
Я думаю, вы получите его на сайте developer.apple.com после того, как зарегистрируете учетную запись разработчика. - person Troubadour; 27.09.2009