Results 1 to 4 of 4

Thread: QtSingleApplication : QtGui/QApplication.h: No such file or directory

  1. #1
    Join Date
    Oct 2009
    Posts
    38
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Unhappy QtSingleApplication : QtGui/QApplication.h: No such file or directory

    Hi all,

    I am not sure where to post this. Although I am a major newbie to Qt, I have been developing in C++, C#, and Java for some years now. I don't want to tick anyone off by posting incorrectly, so please forgive me if I've done wrong, and let me know if I should have posted in another section.

    I'll begin by saying I'm on Vista Home Premium SP2, and I'm developing in Qt 4.5. I have worked only on windows in VS, but my new job requires I learn Qt and cross-platform. I have been tasked with rewriting a small application that was originally written in Qt. The reason for the rewrite is that the architecture is completely being changed. The old version used QtSingleApplication so I referenced that in my application as a subproject, and it compiled and I ran the program.

    The directory of the application I am building (that contains my .pro file) was two levels down from the dev folder, and the qsingleapplication folder is one level down. In other words, my app was C:\Users\...\dev\My app\My app 3.0, and the other is C:\Users\...\dev\qtsingleapplication. I moved the My app 3.0 folder up one and removed the My app folder completely, so that both folders lived directly under dev. I then changed the .pro file so that instead of include(../../qtsingleapplication/src/qtsingleapplication.pri) I have include(../qtsingleapplication/src/qtsingleapplication.pri). From that point on I can't compile, and get the error: QtGui/QApplication.h: No such file or directory.

    The Compile Output window in Qt 4.5 says the problem is happening with C:/Users/../dev/qtsingleapplication/src/qtsingleapplication.h, and indicates the include line:

    #include <QtGui/QApplication>

    Of course, when an include doesn't work, Qt Creator 1.2.1 is supposed to underline the included library name. I tried just adding a random character at the end of QApplication, and the underline showed up, but without that random character, no underline shows, which means to me that Qt Creator did in fact find that file. But I can't compile for the life of me. I cleaned my project, and even went to the extent of shutting Qt Creator down, removing all files created by the compilation process, and starting Qt Creator back and then recompiling, and it didn't help.

    Believe me when I say I've scoured the web, and this forum, to find an answer to this problem, before even thinking of asking my question here. If anyone can help me get past this problem I would really appreciate it.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QtSingleApplication : QtGui/QApplication.h: No such file or directory

    Could you paste the compilation output and possibly your .pro file that includes the .pri file?
    J-P Nurmi

  3. #3
    Join Date
    Oct 2009
    Posts
    38
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: QtSingleApplication : QtGui/QApplication.h: No such file or directory

    Sure thing. Both .pri files shown below are from the qtsingleapplication subproject that is pulled from the Qt website, and I haven't changed them. Since we're only allowed 10000 characters per post, I cut the output that came after the error, since that's just a result of the initial error itself. I have given the output, the project file, and two pri files below:

    ------- Compilation Output Start ------
    Running build steps for project MyProject...
    Starting: C:/Qt/qt-win-opensource-src-4.5.1/bin/qmake.exe C:/Users/bruce/Projects/Qt/MyProject/MyProject 3.0/MyProject.pro -spec win32-g++ -r
    Exited with code 0.
    Starting: C:/MinGW/bin/mingw32-make.exe -w
    mingw32-make: Entering directory `C:/Users/bruce/Projects/Qt/MyProject/MyProject 3.0'
    C:/MinGW/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `C:/Users/bruce/Projects/Qt/MyProject/MyProject 3.0'
    c:\Qt\qt-win-opensource-src-4.5.1\bin\uic.exe src\mainwindow.ui -o ui_mainwindow.h
    c:\Qt\qt-win-opensource-src-4.5.1\bin\uic.exe src\aboutwindow.ui -o ui_aboutwindow.h
    g++ -g -frtti -fno-exceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN ../qtsingleapplication/src/qtsingleapplication.cpp -o ../qtsingleapplication/src/QtSingleApplication
    In file included from ../qtsingleapplication/src/qtsingleapplication.cpp:48:
    ../qtsingleapplication/src/qtsingleapplication.h:48:30: QtGui/QApplication: No such file or directory
    In file included from ../qtsingleapplication/src/qtsingleapplication.cpp:48:
    ../qtsingleapplication/src/qtsingleapplication.h:69: error: expected class-name before '{' token
    ../qtsingleapplication/src/qtsingleapplication.h:72: error: ISO C++ forbids declaration of `Q_OBJECT' with no type
    ../qtsingleapplication/src/qtsingleapplication.h:72: error: expected `;' before "public"
    ../qtsingleapplication/src/qtsingleapplication.h:74: error: expected `,' or `...' before '&' token
    ../qtsingleapplication/src/qtsingleapplication.h:74: error: ISO C++ forbids declaration of `QString' with no type
    ../qtsingleapplication/src/qtsingleapplication.h:75: error: `Type' has not been declared
    ../qtsingleapplication/src/qtsingleapplication.h:75: error: ISO C++ forbids declaration of `type' with no type
    ------- Compilation Output Finish ------


    ------ Project .pro File Start ------
    # -------------------------------------------------
    # Project created by QtCreator 2009-09-17T12:23:25
    # -------------------------------------------------
    CONFIG += qt
    QT += gui \
    core \
    network \
    xml
    TARGET = MyProject
    TEMPLATE = app
    SOURCES += src/main.cpp \
    src/mainwindow.cpp \
    src/passwords.cpp \
    src/cards.cpp \
    src/store.cpp \
    src/rightpanel.cpp \
    src/datamanager.cpp \
    src/abstractdata.cpp \
    src/passwordoptionsdata.cpp \
    src/passwordhistorydata.cpp \
    src/passworddata.cpp \
    src/carddata.cpp \
    src/configuration.cpp \
    src/aboutwindow.cpp
    HEADERS += src/mainwindow.h \
    src/passwords.h \
    src/cards.h \
    src/store.h \
    src/rightpanel.h \
    src/datamanager.h \
    src/abstractdata.h \
    src/passwordoptionsdata.h \
    src/passwordhistorydata.h \
    src/passworddata.h \
    src/carddata.h \
    src/configuration.h \
    src/aboutwindow.h
    FORMS += src/mainwindow.ui \
    src/aboutwindow.ui
    include(../qtsingleapplication/src/qtsingleapplication.pri)
    OTHER_FILES += src/res/MyProject.rc
    RESOURCES += pictures.qrc
    RC_FILE = src/res/MyProject.rc
    ------ Project .pro File Finish ------


    ------ QtSingleApplication .pri File Start ------
    include(../common.pri)
    INCLUDEPATH += $$PWD
    DEPENDPATH += $$PWD
    QT *= network
    CXXFLAGS += -s

    qtsingleapplication-uselib:!qtsingleapplication-buildlib {
    LIBS += -L$$QTSINGLEAPPLICATION_LIBDIR -l$$QTSINGLEAPPLICATION_LIBNAME -dead_strip
    } else {
    SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp
    HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h
    }

    win32 {
    contains(TEMPLATE, lib):contains(CONFIG, shared)EFINES += QT_QTSINGLEAPPLICATION_EXPORT
    else:qtsingleapplication-uselibEFINES += QT_QTSINGLEAPPLICATION_IMPORT
    }
    ------ QtSingleApplication .pri File Finish ------


    ------ Common .pri File Start ------
    infile(config.pri, SOLUTIONS_LIBRARY, yes): CONFIG += qtsingleapplication-uselib
    TEMPLATE += fakelib
    QTSINGLEAPPLICATION_LIBNAME = $$qtLibraryTarget(QtSolutions_SingleApplication-2.6)
    TEMPLATE -= fakelib
    QTSINGLEAPPLICATION_LIBDIR = $$PWD/lib
    unix:qtsingleapplication-uselib:!qtsingleapplication-buildlib:QMAKE_RPATHDIR += $$QTSINGLEAPPLICATION_LIBDIR
    ------ Common .pri File Finish ------

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QtSingleApplication : QtGui/QApplication.h: No such file or directory

    I can't spot the problem, but something must screw up the INCLUDEPATH. As we can see from the compiler command:
    g++ -g -frtti -fno-exceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN ../qtsingleapplication/src/qtsingleapplication.cpp -o ../qtsingleapplication/src/QtSingleApplication
    ...necessary -I switches are missing.
    J-P Nurmi

Similar Threads

  1. QtGui/QApplication: No such file or directory
    By codeslicer in forum Qt Programming
    Replies: 4
    Last Post: 9th December 2011, 15:29
  2. some questions about install qwt
    By dycjiaoda in forum Qwt
    Replies: 1
    Last Post: 8th February 2011, 01:37
  3. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  4. QApplication: No such file or directory
    By Dolinski in forum Newbie
    Replies: 4
    Last Post: 24th May 2007, 05:13
  5. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 10:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.