随笔 - 70, 文章 - 0, 评论 - 9, 引用 - 0
数据加载中……

Qt的VS插件安装

    Qt默认使用mingw编译,不支持VS编译器,因此,如果需要用VS开发,需要将Qt重新编译。

前提:Qt已安装(http://qt.nokia.com/downloads-cn),VS已安装。

1  下载Visual Studio Add-in
    http://qt.nokia.com/downloads-cn

2  安装Visual Studio Add-in

3  重新编译Qt
    a)  用Visual Studio Command Prompt进行编译。
        开始菜单 --> Microsoft Visual Studio 2008 --> Visual Studio Tools --> Visual Studio Command Prompt。
        注意:是使用Visual Studio Command Prompt,而不是直接的cmd Dos窗口。
    b)  进入Qt的安装目录后,执行CD Qt,进入Qt的根目录。
        cd C:\Qt\2010.05\qt。
    c)  运行命令 configure -platform win32-msvc2008。o(选择opensource模式)回车,Y(同意license)回车
        编译时间我用了半个小时。
    d)  运行命令nmake。
        需要大概3个小时。
        编译期间会产生编译错误,我编译的是Windows 7下的VS2008版本。解决方法如下:
错误:
api\qscriptextensionplugin.h(43): Error: Undefined interface
NMAKE : fatal error U1077: 'C:\Qt\2010.05\qt\bin\moc.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
解决:
删除
C:/Qt/2010.05/qt/src/script/tmp/moc/debug_shared/mocinclude.tmp
C:/Qt/2010.05/qt/src/script/tmp/moc/release_shared/mocinclude.tmp

其他错误解决:
删除
C:/Qt/2010.05/qt/src\3rdparty\webkit\WebCore\tmp\moc\debug_shared\mocinclude.tmp
C:/Qt/2010.05/qt/src\3rdparty\webkit\WebCore\tmp\moc\release_shared\mocinclude.tmp



参考:http://tech.it168.com/a2010/1217/1139/000001139431_1.shtml
            http://developer.qt.nokia.com/wiki/QtVSAddin  (通过源码进行编译配置)
            http://blog.csdn.net/hongqiang200/archive/2010/09/09/5873585.aspx    (编译错误解决)

4  配置VS。
   打开VS2008。Qt --> Options,增加Path:C:\Qt\2010.05\qt。
   打开pro文件或者新建Qt项目即可。
   如果之前是mingw版本,那么在增加path时可能出现:qt in the given path was built using mingw。
   解决方法:删除C:\Qt\2010.05\qt\lib下的libqtmain.a和libqtmaind.a,因为是通过找这2个文件判断是否是mingw编译版本。(可剪切到其他地方,以防再需要回到mingw版本)

posted on 2011-01-06 09:34 seahouse 阅读(5367) 评论(0)  编辑 收藏 引用 所属分类: IDE


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理