1, modify the environment variable tool recommended: Rapid environment Editor. Official website: http://www.rapidee.com/
Please back up the current environment variables before modifying them. And then:
(1) Check the system variable path, delete information about other MinGW, so as to avoid conflict with the subsequent mingw32-make.
(2) Check the user variables include, LIB, PATH, MSDevDir, and Msvcdir to remove information about \microsoft Visual STUDIO\VC98 because they will conflict with subsequent mingw32-make, resulting in compilation errors.
2, install the MinGW compiler on the computer, assuming the path is installed in the C:\QT\MINGW32. Add C:\Qt\mingw32\bin to the environment variable path, open the DOS command line input gcc--version and g++--version and Mingw32-make--version Verify that the compiler installation was successful. I use the MinGW version is V4.8.2, the software from the QT official website: http://download.qt-project.org/development_releases/prebuilt/mingw_32/ i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z
3, unzip the Qt-everywhere-opensource-src-4.8.6.zip and enter the directory. Example: D:\qt-everywhere-opensource-src-4.8.6\
4. Execute the following DOS command in turn:
(1) configure-debug-and-release-opensource-prefix "D:\Qt4.8.6"-platform win32-g++-nomake demos-nomake Examples
A description of the common use options:
-debug-and-release compiling debug and release versions
-opensource Select Open Source Agreement and confirm
-platform win32-g++ using MinGW compilation
-prefix "D:\Qt4.8.6" specifies the compilation result directory, if not specified, the default current
-shared creating and using shared QT libraries
-static creating and using a static QT library
-nomake Demos-nomake Examples do not compile routines
-nomake tests does not compile tests
-skip Qtwebkit ignores Qtwebkit, because compiling it is particularly time consuming
-MP using multi-core optimization compilation
(2) Mingw32-make
(3) Mingw32-make Install
5, after the completion of the compilation, the C:\Qt\mingw32\bin\ path under the three files Libgcc_s_dw2-1.dll, Libstdc++-6.dll and libwinpthread-1.dll copy to D:\ Qt-everywhere-opensource-src-4.8.6\bin\. Also, restore the environment variables that you backed up in step 1.
6. Modify QT Installation path
The path selected at the time of the initial compilation is D:\Qt4.8.6\. If you want to copy it to another drive letter, and rename it, for example: C:\Qt\4.8.6_MinGW. Is that going to be a problem? Yes, there will be problems, because QT has absolute path dependence. Renamed after C:\Qt\4.8.6_MinGW\bin\ exe execution program will be a problem, either the program can not open, or the multi-lingual exception. Use Notepad to open C:\Qt\4.8.6_MinGW\bin\qmake.exe, find the keyword "Qt_prfxpath", you can see that the original installation path contains. We can not manually modify the Qmake.exe, the really effective solution is:
Create a qt.conf file under the C:\Qt\4.8.6_MinGW\bin\ path with the contents of
[Paths]
Prefix = C:/Qt/4.8.6_mingw
Note: The qt.conf file must be in ANSI format, and the prefix slash style takes Linux, not Windows, otherwise it will fail. or use "Prefix =." ", so that any path is valid.
7. Reference documents
QT builds on each platform Qt-everywhere
http://my.oschina.net/crucian/blog/223107
Statically compiling Qt4.8.2 and Qt5.1.1 with MinGW
http://blog.csdn.net/markl22222/article/details/20734085
QT compilation. Detailed explanation of/configure parameters
Http://www.cppblog.com/lauer3912/articles/136423.html
QT5.1 post-compilation installation directory issues
Http://www.qtcn.org/bbs/read-htm-tid-54625-fpage-6.html
http://blog.csdn.net/libaineu2004/article/details/24620709
Compiling QT 4.8.6 in a Windows environment using MinGW