Results 1 to 5 of 5

Thread: QtGui/QApplication: No such file or directory

  1. #1
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation QtGui/QApplication: No such file or directory

    So, recently Nokia released QtSingleApplication under LGPL (found in Qt Solutions). So, I downloaded the .zip file, unzipped it, and copied it to $QTDIR\src\qtsingleapplication. Then, due to some limitations of LGPL, I open Command Prompt, cd'd to that directory, and ran "configure.bat -library", ran qmake, and then make.

    In main.cpp I have a QtSingleApplication object instead of QApplication, so I put "#include <QtSingleApplication>" at the top.

    So now in Qt Creator, everything seems good - Qt Creator seems to recognize the existence of QtGui/QApplication. But the compiler doesn't:

    In file included from c:/Qt/4.5/qt/src/QtSingleApplication/src/QtSingleApplication.cpp:48:
    c:/Qt/4.5/qt/src/QtSingleApplication/src/qtsingleapplication.h:48:30: QtGui/QApplication: No such file or directory
    In file included from c:/Qt/4.5/qt/src/QtSingleApplication/src/QtSingleApplication.cpp:48:
    c:/Qt/4.5/qt/src/QtSingleApplication/src/qtsingleapplication.h:69: error: expected class-name before '{' token

    ...
    And it goes on with errors like that, it basically seems like it can't find the Qt includes, but my environment variables are all good. Any ideas?

    ~codeslicer

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QtGui/QApplication: No such file or directory

    How does you project file look like?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Re: QtGui/QApplication: No such file or directory

    This is my project file:

    Qt Code:
    1. include(C:\Qt\4.5\qt\src\qtsingleapplication\src\qtsingleapplication.pri)
    2.  
    3. TEMPLATE = app
    4. QT += gui \
    5. core \
    6. network
    7. CONFIG += qt \
    8. warn_on \
    9. resources \
    10. debug
    11. DESTDIR = bin
    12. OBJECTS_DIR = build
    13. MOC_DIR = build
    14. UI_DIR = build
    15. SOURCES += src/main.cpp \
    16. src/mainwindow.cpp \
    17. src/about.cpp \
    18. src/settings.cpp \
    19. src/parser.cpp
    20. HEADERS += src/mainwindow.h \
    21. src/about.h \
    22. src/settings.h \
    23. src/parser.h
    24. FORMS += ui/mainwindow.ui \
    25. ui/about.ui
    26. RESOURCES += res/main.qrc
    27. RC_FILE += src/main.rc
    To copy to clipboard, switch view to plain text mode 

    And then qtsingleapplication.pri is like this:

    Qt Code:
    1. include(../common.pri)
    2. INCLUDEPATH += $$PWD
    3. DEPENDPATH += $$PWD
    4. QT *= network
    5.  
    6. qtsingleapplication-uselib:!qtsingleapplication-buildlib {
    7. LIBS += -L$$QTSINGLEAPPLICATION_LIBDIR -l$$QTSINGLEAPPLICATION_LIBNAME
    8. } else {
    9. SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp
    10. HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h
    11. }
    12.  
    13. win32 {
    14. contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTSINGLEAPPLICATION_EXPORT
    15. else:qtsingleapplication-uselib:DEFINES += QT_QTSINGLEAPPLICATION_IMPORT
    16. }
    To copy to clipboard, switch view to plain text mode 

    And common.pri:

    Qt Code:
    1. infile(config.pri, SOLUTIONS_LIBRARY, yes): CONFIG += qtsingleapplication-uselib
    2. TEMPLATE += fakelib
    3. QTSINGLEAPPLICATION_LIBNAME = $$qtLibraryTarget(QtSolutions_SingleApplication-2.6)
    4. TEMPLATE -= fakelib
    5. QTSINGLEAPPLICATION_LIBDIR = $$PWD/lib
    6. unix:qtsingleapplication-uselib:!qtsingleapplication-buildlib:QMAKE_RPATHDIR += $$QTSINGLEAPPLICATION_LIBDIR
    To copy to clipboard, switch view to plain text mode 
    Last edited by codeslicer; 7th July 2009 at 18:02. Reason: changed quote to code

  4. #4
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QtGui/QApplication: No such file or directory

    Well, Google ended up being the savior. Apparently it's a compiler bug as the Include path wasn't included in the compilation of the Solution. So I had to manually edit the Makefile, as shown in a comment by Brett in the end of this page: http://labs.trolltech.com/blogs/2009...work-solution/

  5. #5
    Join Date
    Dec 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QtGui/QApplication: No such file or directory

    I also got this error after modifying the qtsingleapplication.cpp file.

    mingw32-make thought the file QtSingleApplication was a binary compiled from qtsingleapplication.cpp and, because the .cpp file was newer than the "binary", make used its implicit rules to recompile the "binary" from source. Hence the lack of include flags in the compilation command and the inaccessible header files.

    Solved it with a "touch QtSingleApplication".

Similar Threads

  1. some questions about install qwt
    By dycjiaoda in forum Qwt
    Replies: 1
    Last Post: 8th February 2011, 02:37
  2. Replies: 3
    Last Post: 29th June 2007, 09:32
  3. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 16:21
  4. QApplication: No such file or directory
    By Dolinski in forum Newbie
    Replies: 4
    Last Post: 24th May 2007, 06:13
  5. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 11: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.