I build Qt from source many, many times and often encounter this intermittent error:
NMAKE : fatal error U1077: ‘cd’ : return code ‘0x2’
Building Qt with configure and nmake takes at least an hour, and I have wasted many hours of my life rebuilding Qt (one of the suggestions that often works to fix the U1077 error is “Rerun nmake!” – but it doesn’t work all the time).
I finally found a solution that works (this time anyway, I will update this post if it fails in the future) requires building Qt in Safe Mode, and uses jom for multi-core Qt building (way faster compilation! for multi-core processors anyway)
Reproduced verbatim from: http://qt-project.org/forums/viewthread/5362/#33212
All credit goes to agent8261
I too had problems trying to install Qt 4.7.2 and integrating it with visual studio. When I tried to compile Qt using nmake I always got an error stating that some dll was in use. The actual dll changed every time. After about 2 days of searching and trying things, I fixed it, but I’m not at all sure what was wrong. Hopefully this will help. Here are the exact steps I had to do in order to compile: 1: I uninstalled all the QT binaries. 2: I deleted the Qt folder. 3: I downloaded the Visual Studio Add-in [qt.nokia.com] 4: I installed the visual studio add-in 5: I downloaded the Qt source code [get.qt.nokia.com] 6: I created New folders c:\Qt\4.7.2-vc\ and extracted the source code to it. 7: I set the environment variables: QTDIR = C:\Qt\4.7.2-vc\ QMAKESPEC = win32-msvc2010 8: I added to the Path variable: cd C:\Qt\4.7.2-vc\bin !!Check!! If you set it up like I did, then you should be able to do: C:\Qt\4.7.2-vc\configure.exe -help from the windows cmd prompt. 9: I downloaded the lasts version of “jom”: ftp://ftp.qt.nokia.com/jom/ 10: I created the folder C:\Qt\4.7.2-vc\jom extracted the jom files to it 11: I restarted windows then opened the VISUAL STUDIO command prompt and ran C: cd C:\Qt\4.7.2-vc configure -debug-and-release -opensource -platform win32-msvc2010 The configuration took awhile. After it was finished 12: I RESTARTED IN SAFE MODE!!!! I don’t know why this step was important, but I had to do the actual compilation in safe mode. 13: Open the VISUAL STUDIO command prompt and run C: cd C:\Qt\4.7.2-vc C:\Qt\4.7.2-vc\jom\jom.exe –j 8 8 is the number of CPU cores for my computer. Building the file took a long time. By far the longest I have ever seen, but if finally finished. Afterwards I had to open visual studio and configure the add-in. Below are the sites that helped me figure everything out. http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/ http://stackoverflow.com/questions/4379374/compiling-qt-visual-studio-2010 http://blog.paulnettleship.com/2010/11/11/troubleshooting-visual-studio-2010-and-qt-4-7-integration/ http://dcsoft.wordpress.com/ FYI: I’m on windows 7, using visual studio 2010 ultimate (version 10.0.30319.1), running on a Intel i7(q720). I compiled 4.72 LGPL version of the QT framework. I am using the Visual Studio Qt add-in 1.1.9-1.