vs2005 QT4.7.1編譯 詳細

http://blog.csdn.net/debugconsole/article/details/8230683css

網上一搜有QT+2005編譯的不少文章,可是都不詳細,不少都編不過,特別的在configure 命令的時候會有 File or path is not found <nmake>提示。這說明系統沒找到VS nmake.exe路徑 。mysql

如下是詳細步驟:c++

一:下載安裝VS2005  這裏不詳細說明web

二:下載QT源碼包,這裏是Qt4.71(qt-everywhere-opensource-src-4.7.1.tar.gz)sql

三:解壓QT源碼包到C盤 這裏路徑爲 c:\qt\qt4.7.1-2005\windows

四:配置環境變量: path中增長 c:\qt\qt4.7.1-2005\bin函數

        建立系統環境變量QMAKESPEC值爲 win32-msvc2005,這個值仍是根據你要生成的Vs版本,6.0 使用win32-msvc, 2003 使用win32-msvc.net, 2005就是 win32-msvc2005ui

        建立 QTDIR值爲 c:\qt\qt4.7.1-2005\this

五:從VC 2005的安裝路徑找到vsvars32.bat(以你本身的安裝目錄爲準,個人是D:/Program Files/Microsoft Visual Studio 8/Common7/Tools)spa

        vsvars32.bat 批處理命令用來在當前進程註冊VS環境變量。

六:運行CMD

C:/> D:

C:/>cd D:/Program Files/Microsoft Visual Studio 8/Common7/Tools
D:/>Program Files/Microsoft Visual Studio 8/Common7/Tools> vsvars32.bat
D:/> cd c:\qt\qt4.7.1-2005\

C:/qt/qt4.7.1-2005>configure -debug-and-release  -stl -platform win32-msvc2005 -no-dsp –vcproj (參數說明見下文)

提示1: Type 'c' if you want to use the Commercial Edition.
         Type 'o' if you want to use the Open Source Edittion.
  根據狀況選擇c或者o

 
 提示2: 是否接受GPL協議
  選擇: y
此過程大約須要10到20分鐘的時間.
 
等待一段時間後,運行 nmake 命令,如:
         >  nmake 
       等待數小時後(視機器條件而定),編譯成功便可;
最後編譯完成後運行nmake confclean命令清除編譯過程當中的臨時文件,以節省空間,大概是770M左右;

七:下載並安裝VS2005的QT插件:qt-vs-addin(qt-vs-addin-1.1.8.exe)

 

八:配置 VS2005 環境
      啓動 VS2005;
      選擇菜單: 「 Tools 」  -〉  「 Options 」 ;
      在彈出窗口中,選擇 左邊 的數狀列表中的 「QT」 -> 「Builds」, 在右邊新增一個變量:
      +--------------+-----------------------------------------------+
      |     Name     |            Path                               |
      +--------------+-----------------------------------------------+
|    qt4.7.1  |    C:/qt/qt4.7.1-2005                        |
      +--------------+-----------------------------------------------+


若是安裝Visual Assist的話,須要配置一下,纔有代碼提示功能.
"VAssistX" -> "Visual Assist X Options ..." -> "Projects", 在"Platform"裏面把"Win32"改成"Custom",
在"Stable include files"末尾添加"c:/qt/qt4.7.1-2005/include".

  至此,環境設置完成;

編譯時參數說明:

configure -debug-and-release 參數的意義是告訴QT同時編譯爲Debug和Release兩個版本的庫,不指定參數則編譯爲Debug版本的動態連接庫若是安裝了多個版本的VS能夠加 上-platform win32-msvc2005(表示VS2005的),6.0 使用win32-msvc, 2003 使用win32-msvc.net, 2008就是 win32-msvc2008。configure大約須要幾分鐘,-nomake examples -nomake demos就是不編譯例子,值錢我介紹的把這兩個目錄移走的方法不太好。可是按個人這個configure變異的話,會有問題的,編譯不經過,由於個人這 是徹底編譯,我編譯了3次才過的,每次到編譯webkit的時候就出錯,聽說這是Qt4.5的bug,可是我從網上找到了解決辦法,就是在 configure以後先不要nmake,刪除c:/qt/qt4.7.1-2005/src/3rdparty/webkit/WebCore/tmp /moc/debug_shared/mocinclude.tmp文件和

c:/qt/qt4.7.1-2005/src/3rdparty/webkit/WebCore/tmp/moc/release_shared/mocinclude.tmp文件,而後再namke吧,必定成功得,呵呵~

 

下面是我從網上搜索到的configure的具體參數,供你們編譯參考:

  我的認爲只須要加個 -fast參數就ok了。其餘參數視本身狀況而定,好比你不須要qt3支持能夠添加-no-qt3support,或者不須要webkit插件 -no-webkit
配置參數選項:
 前面是*號的表示默認參數. +號表示該功能要求被評估,評估成功後才能被接受.
    -release ........... 調試關閉.沒有調試庫,本身的項目只能發佈,不能調試(沒有調試庫的緣故),若是你硬要編譯debug版本的話,會提示找不到xxxxxd.dll 
 *  -debug ............. 只有調試庫,沒有釋放庫,也就是說之後本身的項目只能調試,若是你硬要編譯debug版本的話,會提示找不到xxxxx.dll
 +  -debug-and-release . 編譯後包含兩種庫。最好編譯兩種庫
    -opensource ........ 編譯開源版.
    -commercial ........ 編譯商業版.  這兩個參數通常不需指定,configure開始須要你選擇版本。
    -developer-build ... 編譯開發者選項。
 *  -shared ............動態編譯.
    -static ............ 靜態連接庫.貌似有插件不能用靜態編譯。
 *  -no-fast ........... configure生成全部項目makefiles文件,並編譯
    -fast .............. 只生成庫目錄及子目錄下的項目的makefiles文件. 
    -no-exceptions ..... 關閉異常支持
 *  -exceptions ........ 開啓異常支持.
    -no-accessibility .. 關閉對windows active控件支持.
 *  -accessibility .....對windows active控件支持.
    -no-stl ............ 無c++標準庫支持
 *  -stl ............... 有標準庫支持
尖括號在blogger出問題了。。。。。
    -no-sql- ... Disable SQL entirely, by default none are turned on.
    -qt-sql- ... Enable a SQL in the Qt Library.
    -plugin-sql-  Enable SQL as a plugin to be linked to at runtime.
                         Available values for :
                           mysql
                           psql
                           oci
                           odbc
                           tds
                           db2
 +                         sqlite
                           sqlite2
                           ibase
                         (drivers marked with a '+' have been detected as available on this system)
    -system-sqlite ..... Use sqlite from the operating system.
    -no-qt3support ..... 不提供對qt3函數支持
    -no-opengl ......... 不提供OpenGL函數支持
    -platform ... The operating system and compiler you are building on.
                         (default %QMAKESPEC%)
    -xplatform .. The operating system and compiler you are cross compiling to.
                         See the README file for a list of supported operating systems and compilers.
    -qtnamespace Wraps all Qt library code in 'namespace name {...}
    -D ........ Add an explicit define to the preprocessor.
    -I ... Add an explicit include path.
    -L ... Add an explicit library path.
    -l ... Add an explicit library name, residing in a librarypath.
    -graphicssystem Specify which graphicssystem should be used.
                          Available values for :
 *                         raster - Software rasterizer
                           opengl - Using OpenGL accelleration, experimental!
    -help, -h, -? ...... Display this information.
第三方庫
    -qt-zlib ........... 使用zlib綁定到qt.
 +  -system-zlib ....... 使用操做系統的zlib
                         見 http://www.gzip.org/zlib
    -no-gif ............ 不編譯gif文件讀取支持插件
 +  -qt-gif ............ 編譯gif文件讀取支持插件
                         參見 src/plugins/imageformats/gif/qgifhandler.h
    -no-libpng ......... 不編譯PNG支持插件.
    -qt-libpng ......... 編譯PNG支持插件.
 +  -system-libpng ..... 使用系統libpng庫
                         見 http://www.libpng.org/pub/png
    -no-libmng ......... 不編譯MNG支持插件.
    -qt-libmng ......... 編譯MNG支持插件.
 +  -system-libmng ..... 使用系統的mng庫
                         參見 http://www.libmng.com
    -no-libtiff ........ 不編譯tiff支持插件.
    -qt-libtiff ........ 編譯tiff支持插件.
 +  -system-libtiff .... 使用系統的libtiff庫
                         見 http://www.libtiff.org
    -no-libjpeg ........ 不編譯jpeg支持插件庫
    -qt-libjpeg ........ 編譯jpeg支持插件庫
 +  -system-libjpeg .... 使用系統的jpeg支持庫
                        見 http://www.ijg.org 如下參數僅對qt for windows有效     -no-dsp ............ 不生成 VC++ .dsp 文檔.  *  -dsp ...............生成 VC++ .dsp文檔, 須要有平臺標識符"win32-msvc".注意 qt4開始就不支持vc6.0了因此這兩個參數無效。     -no-vcproj ......... 不生成 VC++ .vcproj 文檔  *  -vcproj ............ 生成 VC++ .vcproj 文檔, 須要平臺標識符"win32-msvc.net".也就是vs2003以上的編譯環境     -no-incredibuild-xge Do not add IncrediBuild XGE distribution commands to custom build steps.  +  -incredibuild-xge .. Add IncrediBuild XGE distribution commands to custom build steps. This will distribute MOC and UIC steps, and other custom buildsteps which are added to the INCREDIBUILD_XGE variable.                          (The IncrediBuild distribution commands are only added to Visual Studio projects)     -no-plugin-manifests  插件不嵌入manifests.  *  -plugin-manifests .. 插件嵌入manifests.     -no-qmake .......... 不編譯qmake  *  -qmake ............. 編譯 qmake.   不建議 不編譯qmake     -dont-process ...... 不生成makefiles和project文檔. 比 -no-fast 參數優先級更高  *  -process ........... 生成makefiles和project文檔.     -no-rtti ........... 不編譯運行時類型信息。  *  -rtti .............. 編譯運行時類型信息。 //下面是對指令的支持,不解釋了     -no-mmx ............ Do not compile with use of MMX instructions  +  -mmx ............... Compile with use of MMX instructions     -no-3dnow .......... Do not compile with use of 3DNOW instructions  +  -3dnow ............. Compile with use of 3DNOW instructions     -no-sse ............ Do not compile with use of SSE instructions  +  -sse ............... Compile with use of SSE instructions     -no-sse2 ........... Do not compile with use of SSE2 instructions  +  -sse2 .............. Compile with use of SSE2 instructions  +  -direct3d ..........  將Direct3D支持編譯進來。檢測不到direct3d sdk 就不支持     -no-openssl ........ Do not compile in OpenSSL support  +  -openssl ........... Compile in run-time OpenSSL support     -openssl-linked .... Compile in linked OpenSSL support     -no-dbus ........... Do not compile in D-Bus support  +  -dbus .............. Compile in D-Bus support and load libdbus-1 dynamically     -dbus-linked ....... Compile in D-Bus support and link to libdbus-1     -no-phonon ......... 不將 Phonon 模塊 編譯進來  +  -phonon ............ 將 Phonon 模塊編譯進來  (若使用的規範的c++編譯器則會自動編譯Phonon模塊)     -no-phonon-backend . Do not compile the platform-specific Phonon backend-plu gin  *  -phonon-backend .... Compile in the platform-specific Phonon backend-plugin     -no-webkit ......... 不將webkit模塊編譯進來,編譯webkit很是耗時間。  +  -webkit ............ 將webkit模塊編譯進來 (若使用的規範的c++編譯器則會自動編譯WebKit模塊)     -no-scripttools .... Do not build the QtScriptTools module.  *  -scripttools ....... Build the QtScriptTools module.     -arch ....... 外觀樣式.                         有如下幾種 :  *                         windows                            windowsce                            boundschecker                            generic     -no-style-尖括號裏包含上面的樣式。

相關文章
相關標籤/搜索