Results 1 to 11 of 11

Thread: QApplication: No such file or directory

  1. #1
    Join Date
    Aug 2007
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Question QApplication: No such file or directory

    Today I have installed Qt 4.3.1 (open source) on my windows XP computer. I was trying to compile my first program "hello world" but I am getting the following errors:

    hello.cpp:1:24: QApplication: No such file or directory
    hello.cpp:2:23: QPushButton: No such file or directory
    hello.cpp: In function `int main(int, char**)':
    hello.cpp:6: error: `QApplication' undeclared (first use this function)
    hello.cpp:6: error: (Each undeclared identifier is reported only once for each f
    unction it appears in.)
    hello.cpp:6: error: expected `;' before "app"
    hello.cpp:8: error: `QPushButton' undeclared (first use this function)
    hello.cpp:8: error: expected `;' before "hello"
    hello.cpp:9: error: `hello' undeclared (first use this function)
    hello.cpp:12: error: `app' undeclared (first use this function)
    hello.cpp:13:2: warning: no newline at end of file
    mingw32-make: *** [hello] Error 1

    I have tried the CONFIG += qt but the problem remains..

    I have the latest mingw (5.1.3) installed. I don't know what to do. I have tried almost everything I found in the web but..

    Please help me to step into the fascinating Qt world!

    Thank's in advance,
    Panos

  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: QApplication: No such file or directory

    Are you using qmake? What does the compiler command look like?
    J-P Nurmi

  3. #3
    Join Date
    Aug 2007
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QApplication: No such file or directory

    I am using the following commands:
    >qmake -project
    >qmake hello.pro
    >make hello

  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: QApplication: No such file or directory

    And what does the compiler command look like (the command starting with "g++", before you get the error message)? Perhaps you should try with the version of MinGW downloaded by the Qt installer.
    J-P Nurmi

  5. #5
    Join Date
    Aug 2007
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QApplication: No such file or directory

    This is the exact output:

    C:\Qt\4.3.1\chap01\hello>make hello
    g++ hello.cpp -o hello
    hello.cpp:1:24: QApplication: No such file or directory
    hello.cpp:2:23: QPushButton: No such file or directory
    hello.cpp: In function `int main(int, char**)':
    hello.cpp:6: error: `QApplication' undeclared (first use this function)
    hello.cpp:6: error: (Each undeclared identifier is reported only once for each f
    unction it appears in.)
    hello.cpp:6: error: expected `;' before "app"
    hello.cpp:8: error: `QPushButton' undeclared (first use this function)
    hello.cpp:8: error: expected `;' before "hello"
    hello.cpp:9: error: `hello' undeclared (first use this function)
    hello.cpp:12: error: `app' undeclared (first use this function)
    hello.cpp:13:2: warning: no newline at end of file
    mingw32-make: *** [hello] Error 1

    I have tried also the mingw version downloaded by the Qt installer. The result is the same. I think something is wrong with the settings and the compiler can't see the include files.

    Maybe something with the configuration, but I can't find what's wrong..

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QApplication: No such file or directory

    I think jpn asked you for the g++ command called by make. What parameters are passed to it? Especially look at the include paths. The must contain %QTDIR%/include

    And make sure QTDIR is defined properly.

  7. #7
    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: QApplication: No such file or directory

    Ah, I think I found the problem. Try plain "make" instead of "make hello".
    J-P Nurmi

  8. #8
    Join Date
    Aug 2007
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QApplication: No such file or directory

    Unfortunately the problem remains..
    Neither "make" worked nor the efforts looking for the QTDIR (everything seems OK).

    This is the output using only "make"

    C:\Qt\4.3.1\chap01\hello>make
    mingw32-make -f Makefile.Debug all
    mingw32-make[1]: Entering directory `C:/Qt/4.3.1/chap01/hello'
    g++ -c -g -g -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL
    -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:/Qt/4.3.1/
    include/QtCore" -I"C:/Qt/4.3.1/include/QtGui" -I"C:/Qt/4.3.1/include" -I"." -I"C
    :/Qt/4.3.1/include/ActiveQt" -I"tmp\moc\debug_shared" -I"." -I"C:/Qt/4.3.1/mkspe
    cs/win32-g++" -o tmp\obj\debug_shared\hello.o hello.cpp
    hello.cpp:13:6: warning: no newline at end of file
    g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runt
    ime-pseudo-reloc -Wl,-subsystem,windows -o "debug\hello.exe" tmp\obj\debug_share
    d\hello.o -L"C:\Qt\4.3.1\lib" -L"C:\Qt\4.3.1\lib" -lmingw32 -lqtmaind -lQtGuid4
    -lQtCored4
    mingw32-make[1]: Leaving directory `C:/Qt/4.3.1/chap01/hello'
    mingw32-make -f Makefile.Release all
    mingw32-make[1]: Entering directory `C:/Qt/4.3.1/chap01/hello'
    g++ -c -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_D
    LL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
    -I"C:/Qt/4.3.1/include/QtCore" -I"C:/Qt/4.3.1/include/QtGui" -I"C:/Qt/4.3.1/inc
    lude" -I"." -I"C:/Qt/4.3.1/include/ActiveQt" -I"tmp\moc\release_shared" -I"." -I
    "C:/Qt/4.3.1/mkspecs/win32-g++" -o tmp\obj\release_shared\hello.o hello.cpp
    hello.cpp:13:6: warning: no newline at end of file
    g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runt
    ime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows -o "release\hello.exe" tmp
    \obj\release_shared\hello.o -L"C:\Qt\4.3.1\lib" -L"C:\Qt\4.3.1\lib" -lmingw32 -
    lqtmain -lQtGui4 -lQtCore4
    mingw32-make[1]: Leaving directory `C:/Qt/4.3.1/chap01/hello'

    If you could understand something that I can't from the above please inform me.

    Or

    I would appreciate it if you could to tell me exactly what to do after installing Qt on windows XP (until the hello compilation) because I think the problem is in the configuration process. What about the environment variables, the configure.exe, the .pro file (do I need to put CONFIG += qt and where), etc.

    Thank's

  9. #9
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QApplication: No such file or directory

    It seems that you are using the debug libraries for the release target...
    Why is that?

    How does your .pro file looks?

    BTW: I should have mentioned that QT opensource for Windows does not install the debug libraries also. You have to compile them.
    So, it is odd, because you seem to have them.

    Regards
    Last edited by marcel; 26th August 2007 at 18:48.

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QApplication: No such file or directory

    Quote Originally Posted by panos View Post
    Unfortunately the problem remains..
    Neither "make" worked nor the efforts looking for the QTDIR (everything seems OK).
    Everything seems OK, because most likely everything is OK. I can't see any errors in the make output. The executable should be in the release directory (or debug if you want to use the debug version).

  11. #11
    Join Date
    Aug 2007
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QApplication: No such file or directory

    Thank's a lot for your help. I think the problem was with the version 4.3.1. I installed Qt 4.1.1 and everything is working properly. Probably the problem was with the environment variables. With 4.1.1 installer the environment variables are set during the installation.

    Thank's!

Similar Threads

  1. QApplication: no such file or directory
    By jochen_r in forum Newbie
    Replies: 13
    Last Post: 15th November 2008, 21:46
  2. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  3. QApplication: No such file or directory
    By Dolinski in forum Newbie
    Replies: 4
    Last Post: 24th May 2007, 05:13
  4. errors while installing Qt4.2 in Linux
    By nimmyj in forum Installation and Deployment
    Replies: 11
    Last Post: 13th December 2006, 11:58
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 12:54

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.