-
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();
}
-
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
-
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
-
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?