Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qmake -project, qmake Work But make doesn't work
Forum Update on Monday, May 27th 2025

Qmake -project, qmake Work But make doesn't work

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 3 Posters 3.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kapeu
    wrote on last edited by
    #1

    I am new to Qt and linux.I have installed Qt(Everywhere- ver -4.6.3) Ubuntu 10 in to the default folder /usr/local/Trolltech.
    i have written following Hello World program.

    @
    #include<qapplication.h>
    #include<qpushbutton.h>

    int main(int argc, char **argv)
    {
    QApplication a(argc,argv);
    QPushButton hello("Hello world!",0);

    hello.resize(100,30);

    hello.show();
    return a.exec();
    }*
    @
    i entered following commands
    @
    qmake -project ( .pro file created using directory name)
    qmake ( Makefile created)
    @
    Then enter make

        following message appeared i could imagine the cause for that  My file name is *HelloQt*
    

    @
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.6.3/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.6.3/include/QtCore -I/usr/local/Trolltech/Qt-4.6.3/include/QtGui -I/usr/local/Trolltech/Qt-4.6.3/include -I. -I. -o HelloQt.o HelloQt.cpp
    g++ -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/Qt-4.6.3/lib -o exampleQt HelloQt.o -L/usr/local/Trolltech/Qt-4.6.3/lib -lQtGui -L/usr/local/Trolltech/Qt-4.6.3/lib -L/usr/X11R6/lib -lQtCore -lpthread
    @

    g++ is installed. Please can anyone help me in this trivial question.?

    [Edit: please use @-formatting for code, peppe]

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rahul Das
      wrote on last edited by
      #2

      Welcome to forum.

      your code @#include<qapplication.h>
      #include <qpushbutton.h>

      int main(int argc, char **argv)
      {
      QApplication a(argc,argv);
      QPushButton hello("Hello world!",0);
      hello.resize(100,30);
      hello.show();
      return a.exec();
      }@

      works fine for me. Except that, i changed the @“@ to @"@


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        You do not have any error at all (at least you did not paste them), the output are the usual compile steps (compiling main.cpp and linking).

        Your executable is named exampleQt. The default for qmake is to name the project file (.pro) and the executable the same as the directory "qmake -project" is run in.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kapeu
          wrote on last edited by
          #4

          Thanks for reply. You can see when enter make it tries to implement the Makefile but it is not finding paths to the includes/ libraries. Is this problem of g++ command? or installation?

          I tried to do it in command line like this,

          g++ HelloQt.cpp -o HelloQt -I/usr/local/Trolltech/Qt-4.6.3/include -lQtGui -lQtCore

          Then following error appeared
          HelloQt.cpp:1:25: error: qapplication.h: No such file or directory
          HelloQt.cpp:2:24: error: qpushbutton.h: No such file or directory
          HelloQt.cpp: In function ‘int main(int, char**)’:
          HelloQt.cpp:6: error: ‘QApplication’ was not declared in this scope
          HelloQt.cpp:6: error: expected ‘;’ before ‘a’
          HelloQt.cpp:7: error: ‘QPushButton’ was not declared in this scope
          HelloQt.cpp:7: error: expected ‘;’ before ‘hello’
          HelloQt.cpp:9: error: ‘hello’ was not declared in this scope
          HelloQt.cpp:12: error: ‘a’ was not declared in this scope

          Do you have any idea for this error?

          [quote author="Volker" date="1326664992"]You do not have any error at all (at least you did not paste them), the output are the usual compile steps (compiling main.cpp and linking).

          Your executable is named exampleQt. The default for qmake is to name the project file (.pro) and the executable the same as the directory "qmake -project" is run in.[/quote]

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            your g++ command line differs significantly from that of your first post, so why should that work?

            I don't get your problem at all. Your stanza of

            @
            qmake -project
            qmake
            make
            @

            worked as expected and without any error.

            Your executable is in the file exampleQt, just start it and you're done.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved