How to compile qt under windows

1.download qt-win  project

http://kde-cygwin.sourceforge.net/qt3-win32/

The qt3 project for windows if you wanna compile qt4 download qt4 opensource  edtion

2.To build qt under windows ,you can use MS VS,MingW,DEV CPP  ….

———————————————————————————–

MingW

Compiling Qt with command line tools

  • Open a cmd shell (make sure you haven’t msys or cygwin in your PATH!)
  • Setup Qt environment
    c:source> set QTDIR=< qt3 source root >
    c:source> set MINGW=< MinGW installation root >
    c:source> set PATH=%QTDIR%bin;%MINGW%bin;%PATH%
    c:source> set QMAKESPEC=win32-g++
  • Configure and build the source
    The script first creates link_includes.exe and configure.exe which are needed for bootstrap the build process. link_includes copies all relevant Qt headers into the include-directory. configure.exe is the replacement for the ./configure-script unter Unix/Linux. After that, qmake.exe is build and the compilation gets started.

    c:source> cd < qt3 source root >
    c:sourceqt-3> configure.bat [-fast] [-verbose]

    configure knows some of the parameters of the x11 release configure script like -fast or -verbose.
    For a full list see binconfigure.exe -help.

    This should build the whole Qt release. If it breaks you can restart compiling with

    c:sourceqt-3> mingw32-make [< target >]

    for a list of all available targets see the toplevel Makefile

  • Start Qt applications
    c:sourceqt-3> designer
    c:sourceqt-3> assistant
    c:sourceqt-3> linguist
    c:sourceqt-3> cd tutorialt1
    c:sourceqt-3tutorialt1> t1

———————————————————————————–
MSVS 2005 or newer

Q… Windows Edition
Compile Instructions:
Packages:

Visual C++ 2005 Express Edition compiling instructions

This page gives you some instructions how getting the Q../Free compiled with the free as beer “Microsoft Visual C++ 2005 Express Edition” tool.

Requirements

  • Windows 2000 or XP
  • Microsoft Visual C++ 2005 Express Edition
  • latest Platform SDK
  • A svn client for svn checkouts (for example Subversion or TortoiseSVN)

Installing “Microsoft Visual C++ 2005 Express Edition” (MSVC8)

Installing latest Platform SDK

Get the Q… sources

  • by downloading a Qt 3 source snapshot from the qtwin download area
  • or from the svn repository (qtwin.svn.sourceforge.net)checkout the sources with
    c:source>  svn co https://qtwin.svn.sourceforge.net/svnroot/qtwin/qt-3/trunk qt-3

Compiling Q… with command line tools

  • Open ‘Visual Studio 2005 Express Command Prompt
  • Setup Q… environment (here sources in C:sourceqt-3, please adjust the path to your needs)
    C:source> set QTDIR=C:sourceqt-3
    C:source> set PATH=%QTDIR%bin;%PATH%
    C:source> set QMAKESPEC=win32-msvc.net
  • Configure and build the source
    The script first creates link_includes.exe and configure.exe which are needed for bootstrap the build process. link_includes copies all relevant Qt headers into the include-directory. configure.exe is the replacement for the ./configure-script under Unix/Linux. After that, qmake.exe is build and the compilation gets started.

    C:source> cd C:sourceqt-3
    C:sourceqt-3> configure.bat [-fast] [-verbose]

    configure knows some of the parameters of the x11 release configure script like -fast or -verbose.
    For a full list see binconfigure.exe -help.

    This should build the whole Q../Free release. If it breaks you can restart compiling with

    C:sourceqt-3> nmake [< target >]

    for a list of all available targets see the toplevel Makefile

  • Start Q… applications
    C:sourceqt-3> designer
    C:sourceqt-3> assistant
    C:sourceqt-3> linguist
    C:sourceqt-3> cd tutorialt1
    C:sourceqt-3tutorialt1> t1

Compiling Q… with the IDE

  • Setup Q… environment in Arbeitsplatz/Eigenschaften/Umgebungsvariablen (german windows)
  • QTDIR=C:sourceqt-3
    QMAKESPEC=win32-msvc.net

    and add C:sourceqt-3bin to the PATH variable

  • Add the Platform SDK path (e.g. C:ProgrammeMicrosoft SDKInclude) at the end of the list to the options inmenu: Tools/Options: Projects and Solutions/VC++ Directories/Incude Files.add also in “/Library Files” the library path (e.g. C:ProgrammeMicrosoft SDKLib)
  • run the configure.bat until it has builded the moc tool and stop it then
  • open and compile the C:sourcesqt-3srcqt_mt.vcproj and qtmain.vcproj with the IDE
  • use other *.vcproj files

———————————————————————————–

Dev-c++

  • Windows NT, 2000 or XP (it has not been tested on Windows 9.x)
  • MinGW
  • Dev-C++ 5
  • A svn client for svn checkouts (for example Subversion or TortoiseSVN)

Installing Dev-C++ already containing MinGW

  • Download Dev-C++ 5 with Mingw/GCC (9.1MB only!) from www.bloodshed.net/dev/devcpp.html.
  • Install Dev-C++ 5, do not enable ‘Class Browsing’, if you are ask for
  • or disable ‘Class Browsing’ in the menu ‘Tools/Editor Options’

Installing Dev-C++ and MinGW separate

  • The latest full MinGW Package from http://www.mingw.org – currently this is MinGW-5.1.1
  • If you don’t want to download 50MB, you need at least the binaries of gcc-core, gcc-g++, w32api, mingw-runtime, binutils, gdb, mingw32-make (7 files, 19MB)

  • Download ‘Dev-C++ 5 executable only’ from www.bloodshed.net/dev/devcpp.html (2.1 MB).
  • Install Dev-C++ 5, do not enable ‘Class Browsing’, if you are ask for
  • or disable ‘Class Browsing’ in the menu ‘Tools/Editor Options’.
  • add your MinGWbin path to Dev-C++ in ‘Tools/Compiler Options/Directories’ or add your MinGWbin path to the PATH variable.

Get the Q… sources

  • by downloading a Qt 3 source snapshot from the qtwin download area
  • or from the svn repository (qtwin.svn.sourceforge.net)checkout the sources with
    c:source>  svn co https://qtwin.svn.sourceforge.net/svnroot/qtwin/qt-3/trunk qt-3

Generating essential tools and files

  • Open a cmd shell
  • Setup Qt and MinGW environment, e.g. Qt in ‘C:sourceqt-3′, and MinGW in ‘C:ProgramsMinGW’ or C:ProgramDev-Cpp (please adjust the paths to your needs)
     C:source> set QTDIR=C:sourceqt-3
     C:source> set MINGW=C:ProgramsMinGW
     C:source> set PATH=%QTDIR%bin;%MINGW%bin;%PATH%
  • Build essential tools by command line
    The script first creates link_includes.exe and configure.exe which are needed for bootstrap the build process. link_includes copies all relevant Qt headers into the include-directory. configure.exe is the replacement for the ./configure-script under Unix/Linux. After that, qmake.exe and moc.exe is build.

    C:source> cd C:sourceqt-3
    C:sourceqt-3> configure-mingw.bat -debug -static

    For a full list of options see binconfigure.exe -help.

  • Stop the compilation if it has finished building ‘qt-3binqmake.exe’
  • Generating Dev-C++ importable files
    Build *.dsp files which could be imported by Dev-C++ with

    C:sourceqt-3> set QMAKESPEC=win32-msvc
    C:sourceqt-3> binconfigure.exe -debug -static

    and also generate Makefiles for the special Qt build process by calling again:

    C:sourceqt-3>configure-mingw.bat -debug -static
  • Break if it has finished building moc and close the cmd shell.

Using Dev-C++

When compiling Qt projects with Dev-C++ you must use the Makefiles generated by qmake. Dec-C++ is ‘only’ a front end to use this makefiles. All compiler/linker options provided by Dev-C++ are disabled by choosing the ‘Custom Makefile’. But one advantage over using the command line only is the user interface of the debugger.

  • Add the QTDIR variable to your environment in ‘My Computer/Properties/Advanced/Environment Variables’
  • Restart Dev-C++

For all Qt project use this procedure:

  • Open Dev-C++ and import the *.dsp file by the menu function ‘File/Import’ (e.g. ‘qt-3exampleshellohello.dsp’)
  • Enable ‘Use custom Makefile’ in ‘Project/Project Options/Makefile’ and choose ‘Makefile’ in the folder of your project (e.g. ‘qt-3exampleshelloMakefile’).

Compiling the Q… libraries

To get the Q… library only, you must build the Qt and main library.

  • Compiling with Dev-C++ import both *.dsp files in the ‘qt-3src’ folder (don’t forget to select Makefile or Makefile.main).
  • If you have time (one hour and more) you can also build everyting (uic, designer, assistant, examples, tutorials …) by using the command line:
    C:source> cd C:sourceqt-3
    C:sourceqt-3> configure-mingw.bat -debug -static
Share

Comments are closed.