I used QT creator to compileCodeIt is completely feasible, but it encounters a small problem, that is, it cannot be compiled successfully with the command line.
However, after half a day of exploration, I finally solved the problem of command line compilation. Although it was troublesome, I should record it.
The solution is as follows:
1. First, find the QT installation path. my options are D:/QT/2009.04/bin;
2. Find the qtenv. BAT file in this path;
3. Open the folder where you need to create a project and copy the BAT file;
4. Open the command line. You can enter CMD in the running process and press Enter;
5. Run the qtenv command.
6. qmake-Project
7. qmake
8. mingw32-make clean (this step is to clear previously generated items if compilation fails, possibly because it has been compiled)
9. mingw32-make
Compiled successfully. You can run it.
I thought it was too troublesome. I tried to add the bin path and include path in the environment variables, but it was not very successful.
Qtenv. BAT file:
@ Echo off
Rem
Rem this file is generated
Rem
Echo setting up a mingw/Qt only environment...
Echo -- qtdir set to D:/QT/2009.04/QT
Echo -- path set to D:/QT/2009.04/QT/bin
Echo -- adding D:/QT/2009.04/bin to path
Echo -- adding % SystemRoot %/system32 to path
Echo -- qmakespec set to win32-g ++
Set qtdir = D:/QT/2009.04/QT
Set Path = D:/QT/2009.04/QT/bin
Set Path = % PATH %; D:/QT/2009.04/bin; D:/QT/2009.04/mingw/bin
Set Path = % PATH %; % SystemRoot %/system32
Set qmakespec = win32-g ++
It is reasonable to say that I add the environment variable path according to the above content, and then add two more environment variables qtdir. qmakespec should achieve the same effect, but it fails. If you know the reason, please do not give me your advice! Thank you !!!