Qt compilation and installation (take 4.2.3 for Windows as an example) [print this page]

Source: Internet
Author: User

Http://www.qtcn.org/bbs/simple/index.php? T7844.html

Qt compilation and installation (take 4.2.3 for Windows as an example)

I have failed to compile the QT library for more than 10 consecutive times. I will summarize my experience and refer to it later.
Qt compilation involves two steps: Configuring Qt in configure and using make to generate the QT library related to the platform.

Step 1: Configure
Configure is critical. There are two main objectives: one is to generate qmake.exe related to the platform using the environment variable qtdir. qmakespecand path. the other is to configure the QT environment, such as where the source file is located, where the library is located, and whether OpenGL is supported. To learn how to configure it, add "Configure -- Help" (UNIX style) to qtdir)
Generate qmake is generally not a problem, as long as there is a supported compiler to set the environment variables. Find the appropriate compiler in readme of qtdir and specify it to qmakespec. do not include spaces in the actual path of qtdir, such as "C: \ Program Files \ QT; PATH is not required.
This is often the error of rcc.exeand uic.exe. If you copy them from other places and get rid of them for a while, it is likely that this problem will be encountered again during the next make process. The correct method is to run configure first, to generate qmake, and then switch to the src directory, qmake, (n) make. as for why, check qt4.2.2 for vs2005. It is not compiled during the installation process (otherwise it will not be installed soon). After installation, there are many EXE files in the bin directory, DLL and other files.
  
As for the compiler, it is best to use the "modern version", which provides better support for the c ++ standard. Is there still people using incomplete antiques such as vc6? I am using vs2005 + SP1. If you have not installed vs2005 IN THE SYSTEM disk, please note that if you only restore the system disk during restoration, it is likely that QT cannot be compiled and installed! I have been tossing for two or three days, and it is also convenient to back up/restore the system. I have installed all the programs on the d disk, and it's okay after six months. This time I hit: it is not an error in configure, or an error in nmake. The error message is "... \ uic.exe
It is not an internal or external program, or a runable program, or u1077, cl.exe exits abnormally, or 0x2. After compiling QT for n times, there was always such an error. Finally, I remembered that the previous success was compiled without restoring the system, it may be that some vs information in the system disk cannot match the number in the program disk, so reinstall vs2005 + SP1, and then everything went smoothly, and it was done on the company's machine and its own notebook. Therefore, it is better to install vs2005 to the system disk. Another problem is the bug of SP1: When you configure it, an error is reported, indicating that the position is in qmap. h, qhash. h. Among the two files, it is too long for MS to release the patch for this bug. Therefore, you can only change the code of these two files to avoid this bug. Method: change the Replace () and insert () member functions in the qmap and qhash templates to implement in the class, and comment out the external implementation (at the end of the file. It seems that vs2005 is so troublesome. I did an experiment under vc6 and everything went well. It seems that there are ancient advantages.

Step 2: Make
This step is to compile the QT Library Based on the makefile generated by qmake in configure. As long as the previous configuration is complete, there will be no problems. If there are errors such as rcc.exeand uic.exe, we recommend that you re-make the src directory.

Note:
2 GB of disk space should be prepared before QT compilation. In fact, the QT directory occupies x GB after compilation, and the rest is used for warning of "insufficient disk space. In addition, QT library compilation takes a long time (about 3 hours, IBM ThinkPad T30 standard machine ). Here is a reference so that friends can have a number in mind during compilation. In this case, both configure and nmake redirect the screen output to a text file. Configure will have 500 or 600 rows of output, which is 30 or 40 kb in size and takes six to seven minutes; nmake has nearly seven thousand rows of output, which is about 2 MB in size and takes about three hours. In this case, you can see the file size or open the output file and check the row number to see where it is going. The attachment contains my configure and nmake output files. Note that the license information is unavailable. I changed it when I published this article.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.