pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

如何為 Visual Studio 2010 構建 Qt

How to build Qt for Visual Studio 2010(如何為 Visual Studio 2010 構建 Qt)
本文介紹了如何為 Visual Studio 2010 構建 Qt的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我一直在努力尋找一個如何為在 Visual Studio 2010 中使用 Qt 提供穩定解決方案的方法,因此在收集了所有信息并進行了一些試驗和錯誤之后,我想將我的解決方案寫入指南.

>

問題,或者為什么不能使用預構建的二進制文件?

似乎在某些特殊情況下使用為 Visual Studio 2008 構建的二進制文件可能會起作用,但我發現它們不起作用.在我的情況下,它們編譯正常,但它們會產生運行時錯誤,如下所示:

或從 Visual Studio 2010 啟動時:

更新:我發現了一篇博客文章,分析了為什么它對某些人有效,而對其他人無效.一句話,這取決于你是否在同一臺機器上安裝了 Visual Studio 2008. 以了解使用或不使用的標志.

configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support -no-multimedia -no-ltcg

一旦 configure.exe 完成(對我來說是 10 分鐘),您需要開始構建過程.使用上述標志大約需要 20-30 分鐘.要啟動它,只需輸入:

nmake

設置環境變量

基本上,我們完成了.你需要做的就是設置你的環境變量(QTDIRPATH),它們告訴程序在哪里可以找到 Qt.如果您使用的是 Windows 7,您可以使用以下命令將 QTDIR 設置為您的安裝目錄.

setx QTDIR e:Qt

對于設置PATH,我強烈建議使用,但我發現它缺少重要信息.

參考文獻

<塊引用>

Qt DevNet 論壇
極簡 Qt 構建的推薦標志
使用 Visual C++ 2010 構建 Qt 4.5
如何將 Qt 編譯為靜態
Qt 4.8:為 Qt 配置選項

中編輯PATH環境變量Windows 沒有痛苦 - op111.net

I struggled finding a how-to which provides a stable solution for using Qt with Visual Studio 2010, so after collecting all the bits of information and some trial and error, I would like to write my solution into a guide.

The problem, or why is it not possible to use prebuilt binaries?

It seems that using binaries built for Visual Studio 2008 might work in some special cases, but I found them not to work. In my case they compiled OK, but they produce runtime errors, like this:

or when started from Visual Studio 2010:

Update: I found a blog post analysing why does it work for some people, while it does not for others. In one word, it depends on whether you have Visual Studio 2008 installed on the same machine, or not. http://blog.paulnettleship.com/2010/11/11/troubleshooting-visual-studio-2010-and-qt-4-7-integration/

The most important thing (that I stupidly didn’t realize) was the fact that you CANNOT use the Visual Studio 2008 compiled libraries and dll’s (available on the Qt webpage) if you don’t have Visual Studio 2008 installed. The reason is because the Qt SDK you download is a debug build which is dependant on the VC9.0 DebugCRT, meaning it needs the Visual C++ 2008 Debug Runtime installed, which is NOT available as a redistributable installer. The only way to install the DebugCRT is to install the entirety of Visual Studio 2008.

解決方案

First of all, it’s very important to understand that for using Qt with Visual Studio 2010, it's not possible to use the pre-built binaries which were made for Visual Studio 2008, but you have to compile it from source.

Downloading Qt

On https://www.qt.io/download/

Update 2017: the latest Qt 4.x branch (Qt 4.8.6) has 2 pre-built packages, which are now in the archive section:

  1. http://download.qt.io/archive/qt/4.8/4.8.6/qt-opensource-windows-x86-vs2010-4.8.6.exe
  2. http://download.qt.io/archive/qt/4.8/4.8.6/qt-opensource-windows-x86-vs2008-4.8.6.exe

You should not download Qt by clicking "Qt libraries 4.8.6 for Windows (Visual Studio 2008, 218 MB)", but by clicking on the "zip" link above it.

On that link, you get a big zip file like "qt-everywhere-opensource-src-4.8.6.zip". Unzip this into a folder and make its path something nice and small, for example "E:Qt"

Visual Studio Command Prompt

Now that we have the sources, we need to build the binaries. To do it, open the Microsoft Visual Studio 2010Visual Studio ToolsVisual Studio Command Prompt (2010) link from your start menu, or even pin it to the taskbar (a good idea). This is a special command prompt which has all the variables set for building with Visual Studio 2010 tools.

Once within the command prompt, navigate to your extracted Qt folder using old-school DOS way, which means you have to change drive letter by E:, enter directories by cd Qt and list dir contents by dir. You can use the tab key for helping you with the directory names. When you have arrived at the correct directory, a dir command should return something like this.

Building Qt

Now it’s time for configure and build. For configuring a minimalist Qt, I'm using the following flags with configure.exe. Just copy and paste it into the command line. Look in the Qt reference manual for what flag to use or not to use.

configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support -no-multimedia -no-ltcg

Once configure.exe has finished (it was 10 minutes for me), you'll need to start the build process. It will take about 20-30 minutes with the above flags. To start it, just type:

nmake

Setting environment variables

Basically, we are done. All you need to do is to set your environment variables (QTDIR and PATH), which tell programs where to find Qt. If you are on Windows 7, you can use the following command to set QTDIR to your installation dir.

setx QTDIR e:Qt

For setting the PATH, I strongly recommend using Path Editor. Within Path Editor

add the directory of Qtin to your PATH

(it doesn't matter if it's in system path or user path)

If you prefer to use Control PanelSystemEnvironment Variables, then you can set these there, too.

Qt Visual Studio Add-in

Here you go, after a logoff-logon or a restart, all the Qt demo applications should start correctly (I recommend have a look at binqtdemo.exe). Now you can download and install the Visual Studio Add-in (qt-vs-addin-1.1.9.exe) from the Qt download page, it will work perfectly.

Appendix A: Official Instructions:

There is a page at the official wiki at the Qt website called Qt 4.8 Installing Qt for Windows, but I found it lacking important information.

References

Qt DevNet forums
Recommended flags for a minimalistic Qt build
Building Qt 4.5 with Visual C++ 2010
How to compile Qt as static
Qt 4.8: Configure options for Qt
Edit the PATH environment variable in
Windows without pain - op111.net

這篇關于如何為 Visual Studio 2010 構建 Qt的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How do I set the icon for my application in visual studio 2008?(如何在 Visual Studio 2008 中為我的應用程序設置圖標?)
Convert CString to const char*(將 CString 轉換為 const char*)
Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio(默認情況下,在 Visual Studio 中從項目中刪除安全警告 (_CRT_SECURE_NO_WARNINGS))
How do I start a new CUDA project in Visual Studio 2008?(如何在 Visual Studio 2008 中啟動新的 CUDA 項目?)
Exporting classes containing `std::` objects (vector, map etc.) from a DLL(從 DLL 導出包含 `std::` 對象(向量、映射等)的類)
What are some reasons a Release build would run differently than a Debug build(發布版本與調試版本的運行方式不同的一些原因是什么)
主站蜘蛛池模板: 昆明挖掘机修理厂_挖掘机翻新再制造-昆明聚力工程机械维修有限公司 | 座椅式升降机_无障碍升降平台_残疾人升降平台-南京明顺机械设备有限公司 | 电池挤压试验机-自行车喷淋-车辆碾压试验装置-深圳德迈盛测控设备有限公司 | 蜂蜜瓶-玻璃瓶-玻璃瓶厂-玻璃瓶生产厂家-徐州贵邦玻璃制品有限公司 | 语料库-提供经典范文,文案句子,常用文书,您的写作得力助手 | 锡膏喷印机-全自动涂覆机厂家-全自动点胶机-视觉点胶机-深圳市博明智控科技有限公司 | 槽钢冲孔机,槽钢三面冲,带钢冲孔机-山东兴田阳光智能装备股份有限公司 | 板式换网器_柱式换网器_自动换网器-郑州海科熔体泵有限公司 | 焊锡丝|焊锡条|无铅锡条|无铅锡丝|无铅焊锡线|低温锡膏-深圳市川崎锡业科技有限公司 | 烟雾净化器-滤筒除尘器-防爆除尘器-除尘器厂家-东莞执信环保科技有限公司 | 济南玻璃安装_济南玻璃门_济南感应门_济南玻璃隔断_济南玻璃门维修_济南镜片安装_济南肯德基门_济南高隔间-济南凯轩鹏宇玻璃有限公司 | 气体检测仪-氢气检测仪-可燃气体传感器-恶臭电子鼻-深国安电子 | 碳刷_刷握_集电环_恒压簧_电刷厂家-上海丹臻机电科技有限公司 | 斗式提升机,斗式提升机厂家-淄博宏建机械有限公司 | 上海防爆真空干燥箱-上海防爆冷库-上海防爆冷柜?-上海浦下防爆设备厂家? | 螺旋压榨机-刮泥机-潜水搅拌机-电动泥斗-潜水推流器-南京格林兰环保设备有限公司 | 灰板纸、灰底白、硬纸板等纸品生产商-金泊纸业 | 汽车水泵_汽车水泵厂家-瑞安市骏迪汽车配件有限公司 | 赛尔特智能移动阳光房-阳光房厂家-赛尔特建筑科技(广东)有限公司 | 安徽泰科检测科技有限公司【官方网站】| 选矿设备-新型重选设备-金属矿尾矿重选-青州冠诚重工机械有限公司 | 螺旋丝杆升降机-SWL蜗轮-滚珠丝杆升降机厂家-山东明泰传动机械有限公司 | 阿尔法-MDR2000无转子硫化仪-STM566 SATRA拉力试验机-青岛阿尔法仪器有限公司 | 油漆辅料厂家_阴阳脚线_艺术漆厂家_内外墙涂料施工_乳胶漆专用防霉腻子粉_轻质粉刷石膏-魔法涂涂 | 协议书_协议合同格式模板范本大全 | 深圳市简易检测技术有限公司| 游戏版号转让_游戏资质出售_游戏公司转让-【八九买卖网】 | 电抗器-能曼电气-电抗器专业制造商| 北京网站建设-企业网站建设-建站公司-做网站-北京良言多米网络公司 | 气动隔膜泵-电动隔膜泵-循环热水泵-液下排污/螺杆/管道/化工泵「厂家」浙江绿邦 | 深圳快餐店设计-餐饮设计公司-餐饮空间品牌全案设计-深圳市勤蜂装饰工程 | 体检车_移动CT车_CT检查车_CT车_深圳市艾克瑞电气有限公司移动CT体检车厂家-深圳市艾克瑞电气有限公司 | 北京网站建设|北京网站开发|北京网站设计|高端做网站公司 | 北京翻译公司_同传翻译_字幕翻译_合同翻译_英语陪同翻译_影视翻译_翻译盖章-译铭信息 | 万濠投影仪_瑞士TRIMOS高度仪_尼康投影仪V12BDC|量子仪器 | 儿童语言障碍训练-武汉优佳加感统文化发展有限公司 | 等离子空气净化器_医用空气消毒机_空气净化消毒机_中央家用新风系统厂家_利安达官网 | 河南新乡德诚生产厂家主营震动筛,振动筛设备,筛机,塑料震动筛选机 | 阴离子_阳离子聚丙烯酰胺厂家_聚合氯化铝价格_水处理絮凝剂_巩义市江源净水材料有限公司 | ★店家乐|服装销售管理软件|服装店收银系统|内衣店鞋店进销存软件|连锁店管理软件|收银软件手机版|会员管理系统-手机版,云版,App | 粉末冶金注射成型厂家|MIM厂家|粉末冶金齿轮|MIM零件-深圳市新泰兴精密科技 |