1. Download the Windows Installation Package of qt3.3.2
It can be accessed through FTP in our school.
FTP: // 211.68.71.81/newmirror/pub/develop/QT/Trolltech.Qt.Enterprise.v3.3.2-ROR.zip
The version is not the latest, but it is enough. It comes with a license, which can be read during installation.
Installation is normal. During the installation process, you will be prompted whether to integrate it into the IDE. At this time, check what ide you are using.
Just click the corresponding one.
Ii. test whether the installation is successful
Create a directory "hello" and "hello. cpp ". 1 # include <qapplication>
2 # include <qlabel>
3
4 int main (INT argc, char ** argv ){
5 qapplication app (argc, argv );
6 qlabel * label = new qlabel ("Hello QT world! ");
7 label-> show ();
8 return app.exe C ();
9}
This is the simplest QT application, and then we enter this directory from the command line.
> Qmake-Project (this command will generate a QT project file. The default name is the directory name)
> Qmake (generate the MAKEFILE file for compiling links)
> Nmake (vs compiler, compile the link according to makefile to generate the EXE file)
If there is no question, a hello.exe file will be generated in the directory to run.
You can also use the following command to generate the VC project file, that is, the. DSP file.
> Qmake-tp vc hello. Pro (VC project file generated based on QT project file)
Open hello. DSP, go to vc6, and choose tools> customize...> add-ins and macro files to check the QT plug-in.
Now we can compile and run the program in vc6.
In addition to the command line method, we can also use the new QT project function on its toolbar to directly develop Qt in IDE.
The details are omitted.
Note that if we use the new project of vc6 (not the new project of QT) and generate a Win32 project, we can also compile the QT program. the source code is written in the same way. You only need to click "Apply QT to current project" on the qt toolbar, and then restart ide To use Qt in the current project. however, if a macro such as q_object is used in the program, the connection to vc6 may encounter an error due to the meta-programming feature of QT. the error message may be as follows: Main. OBJ: Error lnk2001: unresolved external symbol .. qt_property (INT, Int, class qvariant *)"(? Qt_property @ mywidget @ uae_nhhpavqvariant @ Z)
Main. OBJ: Error lnk2001: unresolved external symbol .. qt_emit (INT, struct quobject *)"(? Qt_emit @ mywidget @ uae_nhpauquobject @ Z)
Main. OBJ: Error lnk2001: unresolved external symbol. qt_invoke (INT, struct quobject *)"(? Qt_invoke @ mywidget @ uae_nhpauquobject @ Z)
Main. OBJ: Error lnk2001: unresolved external symbol .. qt_cast (char const *)"(? Qt_cast @ mywidget @ uaepaxpbd @ Z)
At this time, a VC project file must be generated using the command line. During the generation process, nmake will automatically call the MOC object interpreter according to the MAKEFILE file, convert the QT macro code to the Standard C ++ code. When you open the project, you will find some files with the MOC _ prefix, which are explained by MOC. compile the link again.