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)?

  • do you use QtCreator? Or an other IDE?

  • 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 += xmlpatterns

    TARGET = xxx
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = 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):


  • Here it is (I guess there is something wrong with my QT_INSTALL_PREFIX?):
    @iMac:~/xxx/ qmake -query
    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.

  • is it


  • Yepp. Or just qmake if you happen to have only one .pro file in your directory.

  • I run it (qmake, there is only one pro file in the dir) , it seems like Makefile not generated. Where can I find it?

    I ran by specifying the project file but the same thing happens.

  • 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": 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
    -rw-rw---- 1 frank staff 3875 Feb 6 12:56 main.cpp
    -rw-rw---- 1 frank staff 7985 Feb 6 12:56
    -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/ @

  • Anyone?

  • Did you check if these directories exist:


    Also, 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.

  • No, those directories do not exist! Will try to get 4.7.1

  • I did not find the link to 4.7.1 (mac) on qt website. Where is it? Or do I have to build it myself?

  • The downloads is here:

    "Resources" on DevNet =
    click "download" to go to
    click "Go LGPL"
    click "Qt libraries 4.7.1 for Mac" to the beforementioned link

    You can always build Qt yourself. On my 8 core mac pro this lasts about 30 minutes (using make -j8).

  • The same thing happens when I installed 4.7.1

  • Did you make your Qt Creator instance be aware of the new version (Settings/"Cmd-," then Qt 4) and did you change the Qt version for you project? If not it still tries to compile with the old version.

  • I actually removed the old version prior to installing this version. This time, I tried the command line.

    The same problem.

  • I'm lost then. I do not use the precompiled packages and I don't know what's going wrong there.

    As a last resort you can always build Qt yourself.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.