Something wrong with my installation
-
Hi,
I am a newby in QT and cannot even get a starting example to work. The problem is that even QtCore is not found. Think something wrong with my path or not the right version is used?
@#include <QtCore>
#include <iostream>
#include <QtXml/QXmlSimpleReader>int main(int argc, char *argv[])
{
QDir xmldir("/xxx/xxx");
QXmlSimpleReader xmlReader;
}@Example of error is:
/Users/frank/xxx-build-desktop/../xxx/main.cpp:1: error: QtCore: No such file or directory.Checked the path and the path to qmake is /usr/bin/qmake
If I run qmake -v this is printed:
@QMake version 2.01a
Using Qt version 4.7.0 in /Library/Frameworks@I am using Mac 10.6.6
Any reply will be appreciated. -
Can you post here your project file (.pro one)?
-
Gerolf, I am using QtCreator which has been installed earlier today as part of QtSDK.
Here is the project file:
@QT += core gui
QT += xml
QT += webkit
QT += xmlpatternsTARGET = xxx
CONFIG += console
CONFIG -= app_bundleTEMPLATE = app
SOURCES += main.cpp@
-
Can you show us the out put of
@
qmake -query
@It should be something like this (with different paths of course):
@
QT_INSTALL_PREFIX:/usr/local/Trolltech/Qt-4.7.1
QT_INSTALL_DATA:/usr/local/Trolltech/Qt-4.7.1
QT_INSTALL_DOCS:/usr/local/Trolltech/Qt-4.7.1/doc
QT_INSTALL_HEADERS:/usr/local/Trolltech/Qt-4.7.1/include
QT_INSTALL_LIBS:/usr/local/Trolltech/Qt-4.7.1/lib
QT_INSTALL_BINS:/usr/local/Trolltech/Qt-4.7.1/bin
QT_INSTALL_PLUGINS:/usr/local/Trolltech/Qt-4.7.1/plugins
QT_INSTALL_IMPORTS:/usr/local/Trolltech/Qt-4.7.1/imports
QT_INSTALL_TRANSLATIONS:/usr/local/Trolltech/Qt-4.7.1/translations
QT_INSTALL_CONFIGURATION:/Library/Preferences/Qt
QT_INSTALL_EXAMPLES:/usr/local/Trolltech/Qt-4.7.1/examples
QT_INSTALL_DEMOS:/usr/local/Trolltech/Qt-4.7.1/demos
QMAKE_MKSPECS:/usr/local/Trolltech/Qt-4.7.1/mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:4.7.1
@ -
Here it is (I guess there is something wrong with my QT_INSTALL_PREFIX?):
@iMac:~/xxx/ qmake -query
QT_INSTALL_PREFIX:/
QT_INSTALL_DATA:/usr/local/Qt4.7
QT_INSTALL_DOCS:/Developer/Documentation/Qt
QT_INSTALL_HEADERS:/usr/include
QT_INSTALL_LIBS:/Library/Frameworks
QT_INSTALL_BINS:/Developer/Tools/Qt
QT_INSTALL_PLUGINS:/Developer/Applications/Qt/plugins
QT_INSTALL_IMPORTS:/Developer/Applications/Qt/imports
QT_INSTALL_TRANSLATIONS:/Developer/Applications/Qt/translations
QT_INSTALL_CONFIGURATION:/Library/Preferences/Qt
QT_INSTALL_EXAMPLES:/Developer/Examples/Qt/
QT_INSTALL_DEMOS:/Developer/Examples/Qt/Demos
QMAKE_MKSPECS:/usr/local/Qt4.7/mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:4.7.0
iMac:~/xxx/ @ -
The QT_INSTALL_PREFIX is ok, Qt is acutally installed in the root file system.
Can you please call qmake on your project and then run make on the command line (or switch to the compile output in Qt Creator) and show us the command line for the gcc call. The include directory switches there should match the output of qmake -query.
-
Ah, sorry, the default settings of the OS X Qt installer creates XCode projects instead of Makefiles. The wiki article "Generate Makefiles instead of XCode projects on Mac OS X":http://developer.qt.nokia.com/wiki/Generate_Makefiles_instead_of_XCode_projects_on_Mac_OS_X has instructions for how to get rid of this and shows you a permanent solution, if you need one.
-
Here is the output:
@iMac:~/xxx/ qmake -spec macx-g++
iMac:~/xxx/ ls -ltr
total 56
-rw-rw---- 1 frank staff 349 Feb 5 16:06 xxx.pro
-rw-rw---- 1 frank staff 3875 Feb 6 12:56 main.cpp
-rw-rw---- 1 frank staff 7985 Feb 6 12:56 xxx.pro.user
-rw-rw---- 1 frank staff 8974 Feb 6 12:56 Makefile
iMac:~/xxx/ make
g++ -c -pipe -g -gdwarf-2 -Wall -W -DQT_WEBKIT_LIB -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Qt4.7/mkspecs/macx-g++ -I. -I. -I/usr/include/QtCore -I. -I/usr/include/QtGui -I. -I/usr/include/QtXml -I. -I/usr/include/QtXmlPatterns -I. -I/usr/include/QtWebKit -I/usr/include -I. -F/Library/Frameworks -o main.o main.cpp
main.cpp:1:18: error: QtCore: No such file or directory
main.cpp: In function ‘int main(int, char**)’:
main.cpp:27: error: ‘QDir’ was not declared in this scope
main.cpp:27: error: expected `;' before ‘xmldir’
main.cpp:28: error: ‘xmldir’ was not declared in this scope
main.cpp:28: error: ‘QDir’ is not a class or namespace
main.cpp:28: error: ‘QDir’ is not a class or namespace
main.cpp:28: error: ‘QDir’ is not a class or namespace
main.cpp: At global scope:
main.cpp:25: warning: unused parameter ‘argc’
main.cpp:25: warning: unused parameter ‘argv’
main.cpp:63: warning: unused parameter ‘namespaceURI’
main.cpp:63: warning: unused parameter ‘localName’
main.cpp:63: warning: unused parameter ‘qName’
main.cpp:67: warning: unused parameter ‘namespaceURI’
main.cpp:67: warning: unused parameter ‘localName’
make: *** [main.o] Error 1
iMac:~/xxx/ @ -
Did you check if these directories exist:
/usr/include/QtCore
/usr/include/QtGui
/usr/include/QtXml
/usr/include/QtXmlPatterns
/usr/include/QtWebKitAlso, could you try version 4.7.1 of Qt, please. As far as I know there were some packaging errors with 4.7.0.
I cannot check myself, as I never used the precompiled libraries for the Mac, but build on my own.
-
The downloads is here: http://qt.nokia.com/downloads/qt-for-open-source-cpp-development-on-mac-os-x
via
"Resources" on DevNet = http://developer.qt.nokia.com/resources
click "download" to go to http://qt.nokia.com/downloads
click "Go LGPL"
click "Qt libraries 4.7.1 for Mac" to the beforementioned linkYou can always build Qt yourself. On my 8 core mac pro this lasts about 30 minutes (using make -j8).