Install and configure qt4.4.0 + vc60 in Windows

Source: Internet
Author: User
Problems and Solutions:
During qmake of QT and nmake of VC, the latter finds that the <stddef. h> file cannot be found. Failed to solve the problem after some attempts, but the compilation was successful in the VC environment.
Today, I learned QT again and found this problem, so I searched again. I suddenly found this document, which is very good. If I could find it at the time, the problem may have been solved for a long time.
Actually:Register the VC environment variable again, open the CMD console, enter the D: \ Program Files \ Microsoft Visual Studio \ vc98 \ bin directory, and run vcvars32.bat.
Note that if the batch processing uses the abbreviated directory "program ~ 1. It is best to replace it with the actual full path. Otherwise, it may be because the installation is earlier and this directory abbreviation is no longer applicable.
I opened the idea through this post: http://blog.sina.com.cn/s/blog_43ca06360100kbh0.html, thank you.
But later I found this post better: http://hi.baidu.com/shuiyuan2004/blog/item/da75d124ee2c7a054d088d64.html
I would like to attach the original article to express my gratitude and apologize for the insufficient preparation and psychological level at the early stage.
Alas, sometimes although the document is very good, I still don't know it after reading it several times. No way, the process is like this. Pay attention to it next time.

The appendix is as follows:

Qt4.3.4 + VC ++ 6.0 install and configure in Windows

About QT
QT is a multi-platform C ++ graphical user interface application framework.
It provides the functions required for application developers to create an artistic graphical user interface.
QT is fully object-oriented and easily scalable, and allows true component programming.
Since the beginning of 1996, QT has entered the business field and has become the basis for thousands of successful applications around the world.
----------------------------------------------------------------------------------
Version: qt-win-opensource-4.3.4-mingw.exe
Or: qt-win-opensource-src-4.3.4.zip
EXE version. (when installing mingw, you must specify the mingw path. If not, you should click Download to the local directory and install it. If it is missing, you do not know if it will cause any problems.) Click to download and install mingw, very slow ~
After the installation is successful, you still need to compile it. Otherwise, some lib or DLL files will be missing.
1. installation.
Click Install, select the path (for example, set it to d \: QT), click Download mingw, and then wait for a long time ~
2. Compile the environment.
Command Prompt,
D:
Cd qt \ 4.3.4
Configure
Enter nmake as prompted, and then wait a long time ~
3. Set environment variables.
Qmakespec = win32-msvc
Qtdir = D: \ QT \ 4.3.4
Path = % qtdir % \ bin
In this way, if you want to modify the QT path, you only need to change the value of qtdir.
So far, the QT environment has been installed.
4. Test
Let's test it with a small program.
Create a file named hello. cpp and enter the following code:
# Include <qapplication>
# Include <qlabel>
Int main (INT argc, char ** argv ){
Qapplication app (argc, argv );
Qlabel * label = new qlabel ("Hello world! ");
Label-> show ();
Return app.exe C ();
}
Save to an empty file.
Then, open the command prompt, enter the hello. cpp folder, and run:
Qmake-Project
Qmake
Nmake
A. EXE file is generated under the debug folder.
You can also use qmake-T vcapp-O hello. DSP hello. pro to generate a DSP project file, open it in the vc6 environment, compile and debug it.
If you encounter problems during the process, you can refer to the following content:
-------------------------------------------------------------------------------- (Key points)
1) if errors such as stddef. h and string. h cannot be opened during compilation, the VC environment path is not set.
Run cmd.exe, switch to the bin in the VC path, run vcvars32.bat, and set the path of the compiling environment of vc6.0.
If the problem persists, open vcvars32.bat in notepad to check which environment variables are set and add them to the environment variables manually.
For example:
Vscommondir = D: \ Program Files \ Vc ++ \ common \
Msdevdir = D: \ Program Files \ Vc ++ \ common \ msdev98
Msvcdir = D: \ Program Files \ Vc ++ \ vc98
Path = "% msdevdir % \ bin"; "% msvcdir % \ bin"; "% vscommondir % \ tools \ % vcosdir %"; "% vscommondir % \ tools ";
Include = % msvcdir % \ ATL \ include; % msvcdir % \ MFC \ include;
Lib = % msvcdir % \ Lib; % msvcdir % \ MFC \ Lib;

If the path in vcvars32.bat is inconsistent with the actual installation path, you can modify vcvars32.bat and run it again without adding it to the system environment variable.
--------------------------------------------------------------------
2) If the following error occurs during compilation: Fatal error c1083: cannot open include file: 'uxtheme. H': no such file or directory
Prompt uxtheme. H and tmschema. h cannot be found, while schemadef. H is in tmschema. h, so three other files are required, which are not in vc6, including platformsdk in Windows platformsdk which is switched to Visual Studio 2003 or Visual Studio 2005. If you have installed the SDK, you do not have to spend any time downloading the 385.0 mb sdk. By default, all three files are installed in
C: \ Program Files \ Microsoft Visual Studio 8 \ Vc \ platformsdk \ include
(Uxtheme. h defines the uxtheme API referenced in the corresponding code example in the step of adding a style to the control, and tmschema. h defines various classes.
You can download http://www.cnblogs.com/xcvm/archive/2006/03/08/346013.html here
Add these three files to the include folder of VC and compile the files.
--------------------------------------------------------------------
3) when running nmake, if the system prompts that the contained header file or library file cannot be found, first determine whether the environment variable has been set, then try to set the directory containing Qt in the VC: (usually the environment variable is set, so this will not happen)
Tools> Options> directories:
Include files: D: \ QT \ 4.3.4, D: \ QT \ 4.3.4 \ include
Execute files: D: \ QT \ 4.3.4 \ bin
Library files: D: \ QT \ 4.3.4 \ Lib
If the error persists, open the generated makefile. debug or makefile. release file, check whether the incpath item contains the directory where the header file is located, and check whether the lflags item contains the directory where the library file is located. If not, add the file and run qmake again.
--------------------------------------------------------------------
4) Different QT versions make different programs.
In the above example, in qt3.3.2, the system will prompt that the file qapplication cannot be found, and change the header file to <qapplication. h>;
Qlabel * label = new qlabel ("Hello world! ")
You should also change it to qlabel * label = new qlabel ("Hello world! ", 0)
--------------------------------------------------------------------
When compiling the qt-win-opensource-src-4.3.4.zip version in 5), this problem occurs:
Link/nologo/subsystem: console/Incremental: No/out: ".. \ bin \ qmake.exe"
@ C: \ docume ~ 1 \ admini ~ 1 \ locals ~ 1 \ temp \ nma02552.
Metamakefile. OBJ: Error lnk2001: unresolved external symbol "public: _ thiscall dspmakefilegenerator: dspmakefilegenerator (void )"(?? 0dspmakefilegenerator @ Qae @ xz)
.. \ Bin \ qmake.exe: Fatal error lnk1120: 1 unresolved externals
Nmake: Fatal error u1077: 'link': return code '0x460'
Stop.
Run qmakefile first, run cmdnmake, generate the qmake.exe file, copy it to the bin, and then run qconfigure. Bat msvc in the upper directory. It seems that there is no problem. It's really strange ~
--------------------------------------------------------------------
6) If debugging is performed in VC, it is best to use qmake-T vcapp-O hello first. DSP hello. pro, and other command lines to generate project files. If you create a project or add files in VC, errors such as "external symbols cannot be referenced" may occur.

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.