compiling qt program

This is a discussion on compiling qt program within the Linux Programming forums, part of the Platform Specific Boards category; I created a project and simple program in QTDesigner but do not know how to compile it. What are the ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    95

    compiling qt program

    I created a project and simple program in QTDesigner but do not know how to compile it.
    What are the steps involved in compiling such a program. Can I use Kdevelop?
    Here is the program.
    Code:
    #include <qapplication.h>
    #include <qpushbutton.h>
    
    int main(int argc, char **argv)
    {
        QApplication a(argc,argv);
        QPushButton hello("Hello World");
        
        hello.resize(100,30);
        
        a.setMainWidget(&hello);
        hello.show();
        return a.exec();
    }

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    95
    I think I figured out part of the process but I am still having problems.
    1. I set the path variable to include the qmake program
    2. I ran qmake -o Makefile helloworld.pro
    3. I ran make

    I get linking related errors
    such as qapplication.h no such file or directory.

    once again im stuck

  3. #3
    Rebooted Inquirer's Avatar
    Join Date
    Apr 2002
    Posts
    281

    maybe...

    I'm not familiar with the application in question, but if it doesn't know wher et o look for the header, then that couild be a problem. running:
    Code:
    locate qapplication.h
    may help. Now, where you would enter such information , i am clueless. Hope this helps.

    ~Inquirer
    Compilers:
    GCC on Red Hat 8.1 (Primary)
    GCC on Mac OS X 10.2.4 (Secondary)

    Others:
    MinGW on XP

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    95
    I finally succeded in getting the make file to work, by including a variable
    QTDIR = /usr/lib/qt3
    could I create an environmental variable for QTDIR instead so I wouldn't have to edit the make file each time? I'll try it
    Anyhow the code listed above has a problem with the QPushButton hello("hello world");
    Code:
    #include <qapplication.h>
    #include <qpushbutton.h>
    
    int main(int argc, char **argv)
    {
        QApplication a(argc,argv);
        QPushButton hello("Hello World");
        
        hello.resize(100,30);
        
        a.setMainWidget(&hello);
        hello.show();
        return a.exec();
    }
    helloworld.cpp: In function `int main(int, char**)':
    helloworld.cpp:8: no matching function for call to `QPushButton::QPushButton(const char[12])'
    /usr/lib/qt3/include/qpushbutton.h:134: candidates are: QPushButton::QPushButton(const QPushButton&)
    /usr/lib/qt3/include/qpushbutton.h:66: QPushButton::QPushButton(const QIconSet&, const QString&, QWidget*, const char* = 0)
    /usr/lib/qt3/include/qpushbutton.h:65: QPushButton::QPushButton(const QString&, QWidget*, const char* = 0)
    /usr/lib/qt3/include/qpushbutton.h:64: QPushButton::QPushButton(QWidget*, const char* = 0)
    can anyone help me out with this bug I took the program from the kdevelop manual so I wouldn't think there should be errors I understand I have an incorrect parameter const char but does anyone know how to create such a button correctly?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  2. adding an #include stops my program from compiling
    By angelscars in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2005, 05:24 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  4. Replies: 3
    Last Post: 04-19-2004, 09:09 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21