Qt4 with Visual Studio and static C runtime

From qtnode

Jump to: navigation, search

Start off by following the directions is Qt4 with Visual Studio.

(Note: These instructions are known to work with MS Visual Studio 2005 and Qt 4.1.3. If you are using another version, things may be slightly different. See also Trolltech's knowledgebase: Why does a statically built Qt use the dynamic Visual Studio runtime libraries? Do I need to deploy those with my application?)

  1. run qconfigure with -static
  2. edit qmake.conf For MS Visual Studio 2005, you would change the following file: {WhereverYourQtIsInstalled}\mkspecs\win32-msvc2005\qmake.conf.
    change
    QMAKE_CFLAGS_RELEASE    = -O2 -MD
    to:
    QMAKE_CFLAGS_RELEASE    = -O2 -MT
    change
    QMAKE_CFLAGS_DEBUG      = -Od -ZI -Gm -MDd
    to:
    QMAKE_CFLAGS_DEBUG      = -Od -ZI -Gm -MTd
    change
    CONFIG                  += qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe
    to:
    CONFIG                  += qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target
  3. run nmake sub-src
Personal tools