[mark]vs2012编译qt4.8.5

from:http://www.cnblogs.com/russinovich/archive/2012/06/30/2571032.html

Qt安装包:qt-win-opensource-4.8.2-vs2010.exe

编译步骤:

1. 建立环境变量

    QMAKESPEC win32-msvc2010  

    QTDIR          S:\QT\4.8.2        

    Path             S:\QT\4.8.2\bin;


2. 修改 mkspecs\win32-msvc2010\qmake.conf

  将 QMAKE_COMPILER_DEFINES  += _MSC_VER=1600 WIN32 当中的1600改成1700

 

     QMAKE_CFLAGS            = -nologo -Zm200 -Zc:wchar_t-

     改为

     QMAKE_CFLAGS            = -nologo -Zm200 -Zc:wchar_t

3.  在开始菜单中找到 VS2012 x86 Native Tools Command Prompt 并运行

     这一步非常简单但很重要,一定要选择VS2012目录下的bat文件

 

4.  在控制台中,切换到Qt的安装目录下。使用如下参数进行配置

     configure.exe -platform win32-msvc2010 -opensource -debug-and-release -shared -qt-sql-sqlite -plugin-sql-sqlite -qt-zlib -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -qmake -process -rtti -dbus -webkit -script -scripttools -no-dbus

 

5. nmake 开始编译。 不过在编译过程中会遇到几个错需要手动修改一下代码。

%QTDIR%\src\3rdparty\webkit\Source\JavaScriptCore\wtf\HashSet.h 178行

替换为:

template<typename T, typename U, typename V>
inline pair<typename HashSet<T,U,V>::const_iterator, bool> HashSet<T,U,V>::add(const ValueType &value)
{
    auto p= m_impl.add(value);
    return make_pair(typename HashSet<T,U,V>::const_iterator(p.first), p.second);
}

template<typename Value, typename HashFunctions, typename Traits>
template<typename T, typename HashTranslator>
inline pair<typename HashSet<Value, HashFunctions, Traits>::iterator, bool>
HashSet<Value, HashFunctions, Traits>::add(const T& value)
{
    typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter;
    typedef typename HashSet<Value, HashFunctions, Traits>::iterator iter_type;
    auto& temp = m_impl.template addPassingHashCode<T, T, Adapter>(value, value);
    return make_pair((iter_type)temp.first, temp.second);
}

第二个错误 

platform\DefaultLocalizationStrategy.cpp(327) : error C2001: newline in constant
     platform\DefaultLocalizationStrategy.cpp(327) : fatal error C1057: unexpected end of file in macro expansion

     这个错误的原因是因为代码里面的非英文的引号造成的。

    原始的错误代码如下:

     return WEB_UI_STRING("Look Up “<selection>”", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));

     大家注意 <selection> 单词前后的引号。就是它造成编译报错。修改成下面的代码

    return WEB_UI_STRING("Look Up \"<selection>\"", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值