3
votes

I installed Qt and tried to build a template project (Qt4 Gui Application) in QtCreator. I can't figure out why I am getting these errors.

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'
2

2 Answers

3
votes

I'm not sure but I guess you should focus on the first error where it says it can't find AvailabilityMacros.h. I think that should be in /usr/include but I'm guessing it probably isn't since your compile line clearly shows that as one of the include paths.

If it's not there you could try to find out where it is by using find on the command line eg.

find /usr -name AvailabilityMacros.h

or whatever GUI methods are available on the Mac ( you can tell I'm not that familiar with MacOS :) ). BTW if the above find command yields nothing then you can widen the search from /usr to /.


In response to your posting of the find results:

Are you trying to build your application against the MacOSX10.5.sdk? If not then I don't think that's the version you want. If you are using the 10.5 SDK then you need to set the QMAKE_MAC_SDK qmake variable to /Developer/SDKs/MacOSX10.5.sdk. You can either do this in the project file or set it as an additional argument to qmake in Projects->Build steps.

0
votes

Thanks, Troubadour. I was able to solve the problem by adding the following line to my project's .pro file:

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

I would prefer to build against the Mac OS X 10.6 SDK but there is no such directory in /Developer/SDKs. If you know where I can find the 10.6 SDK please let me know.

EDIT: After updating to the latest version of Xcode, I was able to remove the line indicated above from my project's .pro file and compile successfully.