Qt is convenient for cross-platform development, but on Windows, if you link the shared libraries, running the program on machines other than the development machine that do not have the Qt runtime DLLs is troublesome. On the other hand, linking the static libraries makes the executable considerably larger.
A normal installation of the Qt SDK on Windows installs only the shared libraries, so to switch between static and shared libraries as needed, you must build the static libraries yourself from the source code.
Assumed environment
- Windows 7 64bit
- Visual Studio 2010
- A Perl environment is required, so download and install ActivePerl. http://www.activestate.com/activeperl/downloads
Downloading the Qt SDK
Download from http://qt.nokia.com/downloads-jp
- Qt 4.8.0 for Windows(VS 2010, 275 MB)
- Qt Creator 2.4.0 for Windows (53 MB)
Download from ftp://ftp.qt.nokia.com/vsaddin/
- qt-vs-addin-1.1.10.exe
Installation directories
- C:LangQt4.8.0st Static libraries
- C:LangQt4.8.0 Shared libraries
Installing the static libraries
(1) Run qt-win-opensource-4.8.0-vs2010.exe and follow the wizard to install. (Installation directory: C:LangQt4.8.0st)
(2) Create a qt.bat file like the one below and run it from the command prompt.
SETLOCAL CALL "C:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat" x86 ECHO ON SET QTBASEDIR=C:LangQt4.8.0st SET QTDIR=%QTBASEDIR% SET PATH=%QTDIR%bin;%PATH% SET PATH=%SystemRoot%System32;%PATH% SET QMAKESPEC=win32-msvc2010 %comspec% ENDLOCAL
(3) Edit C:LangQt4.8.0mkspecswin32-msvc2010qmake.conf and change it as follows.
(4) At the command prompt, move to C:LangQt4.8.0st and run the following.
(5) After running configure, enter the following, then wait a while.
(6) Build the static libraries with the following command (this takes quite a long time). Plain nmake would try to rebuild even the tools using the static libraries, so add the option.
(7) Delete unnecessary files.
(8) For unnecessary files that were not deleted (listed below), search for those created that day and delete them too.
- Makefile*
- *.vcxproj
- *.vcxproj.*
- *.sln
- tmp
Installing the shared libraries
Run qt-win-opensource-4.8.0-vs2010.exe and follow the wizard to install. (Installation directory: C:LangQt4.8.0)
Switching libraries in Visual Studio 2010
- From the menu, go to [Qt]-[Qt Options] and add 4.8.0st and 4.8.0.
- From the menu, go to [Qt]-[Qt Project Settings] and select 4.8.0st or 4.8.0.
- From the menu, go to [Project]-[… Properties] and set the runtime library for C/C++ code generation to MT (static) or MD (shared).
Qt Creator settings
- If you want to use Qt Creator instead of VS2010, install qt-creator-win-opensource-2.4.0.exe. You don’t need to install MinGW.
- After installation, in [Tools]-[Options], under [Build & Run], click the “Add” button and add C:LangQt4.8.0binqmake.exe.
Recent Posts
- Survey of Inbound Tourist Spending in the Lake Kawaguchiko Area, November 2026
- Visit and Meetings in Tsuruoka City, Yamagata, November 2026
- Monitor Survey of an Audio Guide System at Kiunkaku, a Cultural Facility in Atami
- Supporting a Visitor Survey at One of the World’s Largest Jellyfish Aquariums
- Welcome Party 2026
Archives
- November 2026
- July 2026
- May 2026
- March 2026
- February 2026
- November 2025
- October 2025
- September 2025
- July 2025
- May 2025
- March 2025
- January 2025
- November 2024
- September 2024
- July 2024
- May 2024
- March 2024
- January 2024
- November 2023
- October 2023
- June 2023
- April 2023
- February 2023
- January 2023
- November 2022
- September 2022
- August 2022
- July 2022
- March 2022
- February 2022
- December 2021
- November 2021
- October 2021
- September 2021
- April 2021
- November 2020
- April 2020
- December 2019
- November 2019
- October 2019
- September 2019
- August 2019
- June 2019
- May 2019
- April 2019
- January 2019
- December 2018
- November 2018
- September 2018
- August 2018
- July 2018
- May 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017
- October 2017
- September 2017
- August 2017
- July 2017
- May 2017
- March 2017
- February 2017
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- March 2016
- December 2015
- November 2015
- September 2015
- July 2015
- June 2015
- May 2015
- March 2015
- February 2015
- December 2014
- November 2014
- September 2014
- August 2014
- July 2014
- May 2014
- March 2014
- January 2014
- December 2013
- August 2013
- June 2013
- May 2013
- March 2013
- June 2012
- March 2012
- February 2012
- January 2012
- April 2009