[WIN XP]installed corectly (?) but cant compile tutorial programs
I'm new to QT, i wanted to try it in WinXP, SP 1
i think i installed it correctly (configure.exe and mingw32-make finished without any errors -how i installed everything at the end of post).
then i created a simple file like in tutorial 1 in C:\QT\PRO\ to test QT out:
#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 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}
what i got was error like:
main.cpp: error: class QApplication has no member named 'setMainWidget'.
when i erased the line with setMainWidget program WAS compiled and working corectly.
another problem appeared with program from tutorial 3:
error: qvbox.h no such file or directory.
Looks like not whole QT was installed on my PC, or something with libraries was wrong. Have i installed something not like i should? Here's how i did it:
1. enviromental variables PATH and QMAKESPEC set (added C:QT\4.3.0\bin, win32-g++)
2. before installing i unset the varibles lib and include (set inlude = , set lib=)
3.i used the opensource windows QT 4.3.0 binary and installed (C:\QT\4.3.0\ )
4. downloaded newest MinGW via troltech downloader and installed it (C:\QT\MinGW\ )
5. in command line typed: configure -debug-and-release
compilation finished WITHOUT any errors
6. mingw32-make
took ages but finished without errors
7. i compiled programs from tutorial using
qmake -project
qmake
make
i will appriciate any help i can get here. How can i fix my qt installation?
Today i tried it on the other PC, but i got even more errors while configuring and using mingw32-make on winxp...
Re: [WIN XP]installed corectly (?) but cant compile tutorial programs
QApplication::setMainWidget is deprecated in Qt 4. It is part of the Qt3 support API.
So, if you wish to use it you will have to compile Qt with Qt 3 support enabled, although you don't have any reason to do that, unless you're porting to some application for Qt 3 to Qt 4.
Here's how it is defined:
Code:
#ifdef QT3_SUPPORT
static QT3_SUPPORT
QWidget *mainWidget
();
static QT3_SUPPORT
void setMainWidget
(QWidget *);
#endif
So, in Qt 4, just show the main widget. It will be enough.
Also, QVBox has been replaced in Qt4 by QVBoxLayout.
Note that all deprecated functions are documented, so if you open Assistant and you type in the function name, it will tell you whether it is obsolete or not.
Regards
Re: [WIN XP]installed corectly (?) but cant compile tutorial programs
Quote:
Originally Posted by
marcel
QApplication::setMainWidget is deprecated in Qt 4. It is part of the Qt3 support API.
So, if you wish to use it you will have to compile Qt with Qt 3 support enabled, although you don't have any reason to do that, unless you're porting to some application for Qt 3 to Qt 4.
Here's how it is defined:
Code:
#ifdef QT3_SUPPORT
static QT3_SUPPORT
QWidget *mainWidget
();
static QT3_SUPPORT
void setMainWidget
(QWidget *);
#endif
So, in Qt 4, just show the main widget. It will be enough.
Also, QVBox has been replaced in Qt4 by QVBoxLayout.
Note that all deprecated functions are documented, so if you open Assistant and you type in the function name, it will tell you whether it is obsolete or not.
Regards
thanks,good answer for me