{"id":191,"date":"2008-08-10T18:48:00","date_gmt":"2008-08-10T16:48:00","guid":{"rendered":"http:\/\/www.thelins.se\/johan\/blog\/2008\/08\/commercial-qt-on-vista-using-mingw\/"},"modified":"2008-08-10T18:48:00","modified_gmt":"2008-08-10T16:48:00","slug":"commercial-qt-on-vista-using-mingw","status":"publish","type":"post","link":"https:\/\/www.thelins.se\/johan\/blog\/2008\/08\/commercial-qt-on-vista-using-mingw\/","title":{"rendered":">Commercial Qt on Vista using MinGW"},"content":{"rendered":"<p>>Since I just got my new computer up and running, I wanted to start using Qt. Another new, for me, is Vista, so I decided to get my commercial Qt license up and running using MinGW in Vista. The proved to be a small challenge so I&#8217;ve documented my steps here.<\/p>\n<p>First of all, put your license file in your user directory and try to rename it to <tt>.qt-license<\/tt>. Notice that the file explorer won&#8217;t let you do that. Apparently the only dot denotes the start of the file ending, so in Vista&#8217;s eyes, a file starting with a dot has no name. The solution is, as always, to use a command prompt and good old <tt>ren<\/tt>.<\/p>\n<p>I&#8217;ve downloaded MinGW and the commercial Qt sources for win32. These are installed\/extracted into the Coding directory located in my home directory (being C:\\Users\\Thelin in my case). MinGW lives in Coding\\MinGW while Qt is in Coding\\qt-win-commercial-src-4.4.1.<\/p>\n<p><strong>Building<\/strong><\/p>\n<p>Let&#8217;s continue by using a command prompt and set some environment variables to point out these facts. We need to include MinGW in the PATH variable. Then Qt needs the QTDIR and QMAKESPEC variables to get its foothold.<\/p>\n<pre>set PATH=%PATH%;C:\\Users\\Thelin\\Coding\\MinGW\\bin<br \/><br \/>set QTDIR=C:\\Users\\Thelin\\Coding\\qt-win-commercial-src-4.4.1<br \/><br \/>set QMAKESPEC=%QTDIR%\\mkspecs\\win32-g++<\/pre>\n<p>As we are used to from Unix, we then configure Qt before building it. This is straight forward, but I&#8217;ve included my configure line for completeness.<\/p>\n<pre>configure.exe -debug-and-release -shared -plugin-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -no-libtiff -no-gif -no-dsp -no-vcproj -assistant-webkit<\/pre>\n<p>The last step of the configuring is the construction of QMake for your configuration. It is good to know that the file <tt>pbuilder_pbx.cpp<\/tt> takes ages to build (see TaskTracker #<a href=\"http:\/\/trolltech.com\/developer\/task-tracker\/index_html?method=entry&amp;id=162299\">162299<\/a>). Apparently by design.<\/p>\n<p>When QMake has been built, simply do as told. Run <tt>mingw32-make<\/tt> to build Qt. I choose to add the argument <tt>-j4<\/tt> to utilize my CPU cores better. Don&#8217;t know if it improves the build time much but it makes me feel good.<\/p>\n<p>Now, all that is left is to add <tt>%QTDIR%\/bin<\/tt> to <tt>PATH<\/tt> and to try the Qt demos. However, keep on reading if you want to make the installation easier to use.<\/p>\n<pre>set PATH=%PATH%;%QTDIR%\\bin<\/pre>\n<p><strong>Command Line Conveniences<\/strong><\/p>\n<p>To make it a bit easier to get up and running with Qt, we will create two batch files. First, <tt>qt-vars.bat<\/tt>, that initializes the environment variables as shown in this text (gather all the lines starting with set in a file). To make things fancy, you can create a short-cut to this file. Set it to run <tt>cmd \/K qt-vars.bat<\/tt> to end up with an intialized command prompt &#8211; quite nice.<\/p>\n<p>The second batch file that I mentioned before is <tt>make.bat<\/tt>. Make it run <tt>mingw32-make<\/tt> and place it somewhere in path. If you want to be able to use command line arguments, pass on a few <tt>%1 %2 %3<\/tt> and so on to MinGW. This will allow you to type <tt>make -j4<\/tt>, instead of prefixing it with <tt>mingw32-<\/tt> every time. You can place this file either in Qt&#8217;s bin directory, or with the MinGW executables.<\/p>\n<p><strong>Eclipse<\/strong><\/p>\n<p>Since the Windows command prompt leaves quite alot to wish for, I prefer trying something else for a change. It it possible to use cygwin or other shell replacements, but hey, we&#8217;re in a graphica environment, so why no try to use something grapical such as Eclipse.<\/p>\n<p>Qt integrates quite well with Eclipse. Start by downloading Eclipse for C\/C++, or just the standard edition with and the C\/C++ support module. Then download the <a href=\"http:\/\/trolltech.com\/developer\/downloads\/qt\/eclipse-integration-download\">Qt integration<\/a>. Commercial license holders will find it in their personal download directory.<\/p>\n<p>Once all the installers have been run, start Eclipse through the Qt Eclipse Integration item on the Windows start menu. Then select File &#8211; New &#8211; Project&#8230; and choose to create Qt application. This will prompt you to specify what Qt version to use in the dialog shown below. Simply point out the version you just built and you are ready to go.<\/p>\n<p><a href=\"http:\/\/www.thelins.se\/johan\/uploaded_images\/qt-settings-706480.png\"><img decoding=\"async\" style=\"DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center\" alt=\"\" src=\"http:\/\/www.thelins.se\/johan\/uploaded_images\/qt-settings-706476.png\" border=\"0\" \/><\/a><br \/>The Qt integration works great &#8211; but sometimes you can get a feeling of nausea. For example, it is not clear from the start how to execute the result of your project. But, then you can always revert to the good old command line.<\/p>\n<p><\/p>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>>Since I just got my new computer up and running, I wanted to start using Qt. Another new, for me, is Vista, so I decided to get my commercial Qt license up and running using MinGW in Vista. The proved to be a small challenge so I&#8217;ve documented my steps here. First of all, put &hellip; <a href=\"https:\/\/www.thelins.se\/johan\/blog\/2008\/08\/commercial-qt-on-vista-using-mingw\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">>Commercial Qt on Vista using MinGW<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-191","post","type-post","status-publish","format-standard","hentry","category-qt"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/comments?post=191"}],"version-history":[{"count":0,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/posts\/191\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/media?parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/categories?post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thelins.se\/johan\/blog\/wp-json\/wp\/v2\/tags?post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}