Installing Qt on Windows (Old instructions)

Please note – these are possibly outdated instructions. Use with caution!

There are two options for developing Qt applications, download off the Qt Project web site or the Nokia web site.

Qt Project:

http://qt-project.org/downloads

Nokia (recommended):

http://www.developer.nokia.com/Develop/Qt/Tools/

The Qt Project provides both open source and commercial versions of Qt. There are certain restrictions if creating a commercial application with Qt. The Nokia version is essentially the same except that it is about 100 times faster to get setup since you don’t need to build sources or install MinGW. As of this writing it appears that Nokia recently began requiring an account to download their SDK.

Since the Qt Project installers are more complicated, instructions for Qt Project downloads are given here.

NOTE: References to opening Grbl Controller’s .pro file in Qt Creator imply that you have installed git (sudo apt-get install git) and then did a git clone https://github.com/zapmaker/GrblHoming. A folder called GrblHoming will be created and inside of it will appear the .pro file along with all the source files.

Windows

Using Qt Project requires a three stage process to get to the point where you can actually use the Qt Creator IDE: Install Qt libraries, run configure, build sources. You also need to download the standalone Qt Creator and connect it to the libraries. This process can take anywhere from a few hours to overnight, most of it unattended.

Download the latest stable “Qt libraries” for Windows, i.e. click on the download link “Qt libraries 4.8.3 for Windows (minGW 4.4, 317 MB)”. If you have Visual Studio 2008 or 2010, you could install a library for your version instead. If you don’t have Visual Studio, then there are some extra steps to get everything running, since you need to install a compiler: MinGW.

MinGW (Windows)

The tricky part is that the Qt installer expects a very specific gcc compiler version. To avoid a lot of hassle, Nokia created a version of MinGW that is compatible with the Qt installer. Get it from the ftp site and extract it to a temp folder, then move the extracted mingw folder into C: so that it appears as C:\mingw:

ftp://ftp.qt.nokia.com/misc/MinGW-gcc440_1.zip

Side Note: I have discovered that the gdb (debugger) in that MinGW zip is not compatible with the latest Qt Creator. I have had better success getting the mingw from the daily builds here:

http://builds.qt-project.org/job/mingw32-windows/

and gdb from:

http://builds.qt-project.org/job/gdb-windowsxp/

I have not found “official builds” yet, so your mileage may vary with these “hot out of the oven” builds. You must extract the first to C:\mingw, then extract the second into the C:\mingw\bin, overwriting the DLLs with the same names. Then rename the gdb executable to gdb.exe. Also ensure that the python lib folder from the gdb download is placed in the bin folder. You may also need to point your debugger in the Qt Creator Build & Run options tab to the gdb.exe.

Don’t bother using the version of MinGW from the MinGW web site because Nokia has made a modified version of MinGW which is required for compilation.

Run the Qt installer you downloaded. Default install location (If you are installing a newer/older version, adjust path as appropriate):

C:\Qt\4.8.3

When it asks for the MinGW location, it should default to C:\MinGW – use that and continue. You should not get any errors and the install should proceed. The install will take a while, about 5-10 minutes. Once complete, uncheck the two checkboxes and finish the wizard.

QMake (Create makefiles) (Windows)

NOTE: If using Visual Studio, you need to change win32-g++ to the appropriate value in the command below.

Open a command window to C:\Qt\4.8.3 and type:

set QMAKESPEC=C:\Qt\4.8.3\mkspecs\win32-g++

set PATH=%PATH%;C:\Qt\4.8.3\bin;C:\mingw\bin

Then run configure.exe, not by double-clicking, but in the command window. Note – you can specify additional parameters on the command line, but the defaults should be acceptable (no parameters needed). Your compile may take less time if you specify -release on the command line.

Answer o for open source and yes if you agree to the LGPL license. After this, configure should run for awhile, about 10 minutes. Once complete, it will tell you what command to give. In the case of Windows and MinGW it is mingw32-make and if starting completely clean, it is mingw32-make confclean, then configure

Type mingw32-make in the command window to start building the sources. This can take about 6-8 hours. Make sure you set your computer not to go into shutdown or standby after awhile, otherwise you’ll need to do a make clean and start again (I ran into this problem and doing a make where you left off doesn’t seem to work)

When done you should see no errors in the final lines of output.

Qt Creator Download, Install and Configure (Windows)

Download the standalone Qt Creator.

Install Qt Creator. It will usually go into a folder like C:\Qt\qtcreator-2.6.0

Open up the GrlbHoming project .pro file. You will be warned that it cannot proceed. You need to bind the MinGW install you just completed. Go to Tools > Options and choose Qt Versions tab. Click Add and find the qmake.exe that was built. This would normally be something like C:\Qt\4.8.3\bin\qmake.exe

Go to Compilers tab and add a compiler. Call it MinGW and the compiler path will usually be C:\mingw\bin\g++.exe

Make sure the ABI is setup properly, it should be something like x86-windows-msys-pe-32bit

Finally go to Kits tab and Add. Name it MinGW, device type Desktop, Run locally, compiler MinGW, Qt version (whatever Qt you have installed).

Click OK to save.

The build button in the lower left should now show options for Release and Debug build. Build the project. I ran into a problem with it choosing the wrong path for rcc.exe. I had to edit .. GcodeSenderGUIthreads-build-mingw-Release\Makefile.release and change the path to be full to c:\Qt\4.8.3\bin\rcc.exe

Rerunning the build fixed the error and I could now run the executable.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>