Results 1 to 5 of 5

Thread: Qt Application is copiling from IDE but giving error while building from teminal?

  1. #1
    Join Date
    Jan 2012
    Location
    India
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Qt Application is copiling from IDE but giving error while building from teminal?

    Hi,

    I am new to Qt.
    I have installed Qt_SDK_Lin32_offline_v1_1_2_en.run. It has installed successfuly.
    When i have created Qt application from Qt IDE, it is building and running but same application is giving error when i try to compile it from terminal.
    My code is

    .pro file:
    Qt Code:
    1. SOURCES = main.cpp
    2. # install
    3. sources.files = $$SOURCES *.pro
    4. INSTALLS += target sources
    5. DESTDIR = release
    6. TARGET = Demo
    To copy to clipboard, switch view to plain text mode 
    main.cpp
    Qt Code:
    1. #include <QApplication>
    2. #include <QLabel>
    3. int main(int argc, char *argv[])
    4. {
    5. QApplication app(argc, argv);
    6. QLabel *label = new QLabel("Hello Qt!");
    7. label->setPixmap(QPixmap(200, 50));
    8. label->show();
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 
    but when i try to compile same project from command line using qmake and make command then it is giving following error.
    Qt Code:
    1. $qmake
    2. WARNING: target.path is not defined: install target not created
    3. WARNING: sources.path is not defined: install target not created
    4.  
    5. $make
    6. g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -o main.o main.cpp
    7. main.cpp:1:24: fatal error: QApplication: No such file or directory
    8. compilation terminated.
    9. make: *** [main.o] Error 1
    To copy to clipboard, switch view to plain text mode 

    I have compiled another project which is working fine in command line on another system with qmake and make. It is not giving any warning while qmake but giving same error while make.

    .pro file for another project is
    Qt Code:
    1. SOURCES = main.cpp
    2. # install
    3. target.path = Demo
    4. sources.files = $$SOURCES *.pro
    5. sources.path = .
    6. INSTALLS += target sources
    To copy to clipboard, switch view to plain text mode 
    main.cpp is same for both.

    Please help me to solve this.
    Thanks

  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: Qt Application is copiling from IDE but giving error while building from teminal?

    What's the purpose of wanting to copy all the sources and project file into current directory? What's the purpose of trying to copy the target executable to a "Demo" directory? What does /usr/include/qt4/QtGui contain? What does qmake -v return?
    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
    Jan 2012
    Location
    India
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: Qt Application is copiling from IDE but giving error while building from teminal?

    Thanks Wysota for your response.

    What's the purpose of wanting to copy all the sources and project file into current directory? What's the purpose of trying to copy the target executable to a "Demo" directory?
    I am doing same on another system. previously i was unaware about Qt creator and designed forms in Qt Designer, write .cpp and .h files for forms and used qmake and make commands to compile and link the application.
    Now i am using Qt creator and want to load and compile the old projects with Qt creator which are on another system (old means 7 days old, i have started Qt 7 days ago).

    What does /usr/include/qt4/QtGui contain?
    /usr/include not contains any folder named Qt4 ot Qt. /usr/lib contains a folder named Qt4.

    What does qmake -v return?
    it is returning
    QMake version 2.01a
    Using Qt version 4.7.4 in /usr/lib/i386-linux-gnu

    Thanks.

  4. #4
    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: Qt Application is copiling from IDE but giving error while building from teminal?

    Quote Originally Posted by gurmeetsingh View Post
    I am doing same on another system. previously i was unaware about Qt creator and designed forms in Qt Designer, write .cpp and .h files for forms and used qmake and make commands to compile and link the application.
    This does not explain why you would want to copy the source code to the current dirrectory while installing the application.

    /usr/include not contains any folder named Qt4 ot Qt. /usr/lib contains a folder named Qt4.
    So you don't have development headers for Qt installed in the location qmake is looking for them.

    it is returning
    QMake version 2.01a
    Using Qt version 4.7.4 in /usr/lib/i386-linux-gnu
    I would assume your QtCreator build uses a different Qt installation (bundled with QtSDK).

    You either need to install appropriate packages for your system (like qt4-devel, libqt4-devel, qt4-dev, libqt4-dev or similar) or use qmake from the installation bundled with QtSDK.
    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.


  5. #5
    Join Date
    Jan 2012
    Location
    India
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Application is copiling from IDE but giving error while building from teminal?

    Thanks Wysota for your reply.

    You either need to install appropriate packages for your system (like qt4-devel, libqt4-devel, qt4-dev, libqt4-dev or similar) or use qmake from the installation bundled with QtSDK.
    I have installed libqt4-dev using command apt-get install libqt4-dev. Now it is working fine.

    Thanks.

Similar Threads

  1. Replies: 0
    Last Post: 6th October 2010, 15:02
  2. Building qt error
    By as001622 in forum Installation and Deployment
    Replies: 1
    Last Post: 20th June 2008, 08:19
  3. WCHAR to QString giving error in vs2005
    By ucomesdag in forum Qt Programming
    Replies: 2
    Last Post: 1st May 2008, 23:25
  4. "make" is giving an error
    By Sarma in forum Qt Programming
    Replies: 6
    Last Post: 21st August 2006, 14:28
  5. Suggestions in giving to my application a cool look
    By SkripT in forum Qt Programming
    Replies: 8
    Last Post: 2nd May 2006, 18:30

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.