gpt4 book ai didi

macos - 无法在 Snow Leopard 上使用 Qt 构建

转载 作者:行者123 更新时间:2023-12-03 22:30:53 28 4
gpt4 key购买 nike

我安装了 Qt 并尝试在 QtCreator 中构建一个模板项目(Qt4 Gui 应用程序)。我不明白为什么会出现这些错误。

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.cppIn 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 directoryIn 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 directoryIn 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 directoryIn 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 directoryIn 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 directoryIn 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 scopeIn 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 1make: Leaving directory `/Users/jason/SourceControl'Exited with code 2.Error while building project SourceControlWhen executing build step 'Make'

最佳答案

我不确定,但我想您应该关注第一个错误,它说找不到 AvailabilityMacros.h。我认为它应该在/usr/include 中,但我猜它可能不是因为你的编译行清楚地表明它是包含路径之一。

如果它不在那里,您可以尝试通过在命令行上使用 find 来找出它的位置,例如。

find /usr -name AvailabilityMacros.h

或者 Mac 上可用的任何 GUI 方法(你可以看出我对 MacOS 不太熟悉 :))。顺便说一句,如果上面的 find 命令没有产生任何结果,那么您可以将搜索从 /usr 扩大到 /


响应您发布的查找结果:

您是否正在尝试针对 MacOSX10.5.sdk 构建您的应用程序?如果不是,那么我认为这不是您想要的版本。如果您正在使用 10.5 SDK,那么您需要将 QMAKE_MAC_SDK qmake 变量设置为/Developer/SDKs/MacOSX10.5.sdk。您可以在项目文件中执行此操作,也可以在项目->构建步骤中将其设置为 qmake 的附加参数。

关于macos - 无法在 Snow Leopard 上使用 Qt 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1478671/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com