• 6618阅读
  • 7回复

使用vc(vs2008)编译Qt5.4 [复制链接]

上一主题 下一主题
离线cangyuegui
 

只看楼主 倒序阅读 楼主  发表于: 2015-04-28

官方的Qt
只有vc10以上的版本
若是想vc9 只能自己编译
so 开始干
搜索资料
1)vc9不能支持webkit的编译 直接删除掉
2)有部分地方 vc9默认支持LONG转ULONG 需要自己改代码
3)需要OPENSSL
4)需要python3.4.3
5)需要activePerl开工
1。下载安装activeperl
2。下载安装python3.4.3
3。编译openssl 0.9.8k
perl Configure VC-WIN32 –prefix=C:\Build-OpenSSL-VC9-32
ms\do_ms
nmake -f ms\nt.mak  
nmake -f ms\nt.mak install

4。开始config Qt5 一个bat搞定
  1. cd /d "C:\Program Files\7-Zip"
  2. call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
  3. if exist E:\qt-everywhere-opensource-src-5.4.0 (
  4. echo "QT FIles exists"
  5. ) else (
  6. REM 7z x D:\Qt\qt-everywhere-opensource-src-5.4.0.zip -oE:\
  7. echo "COPY Qt 5.4.0 Source"
  8. xcopy %~dp0\qt5.4-source E:\qt-everywhere-opensource-src-5.4.0 /s /e /I
  9. )
  10. rd /s /q E:\qt-everywhere-opensource-src-5.4.0\qtwebkit
  11. rd /s /q E:\qt-everywhere-opensource-src-5.4.0\qtwebkit-examples
  12. copy /y %~dp0\dscamerasession.cpp  E:\qt-everywhere-opensource-src-5.4.0\qtmultimedia\src\plugins\directshow\camera
  13. cd /d E:\qt-everywhere-opensource-src-5.4.0
  14. set PATH=C:\Python34;C:\Program Files\7-Zip;%CD%\qtbase\bin;%PATH%
  15. set QTDIR=C:\Qt\5.4.0
  16. configure.bat -developer-build -opensource -nomake examples -nomake tests -mp -confirm-license -opengl desktop -no-icu -skip qtserialport -platform win32-msvc2008 -openssl-linked OPENSSL_LIBS="-lssleay32 -llibeay32" -I "C:\Python34\include" -I C:\Build-OpenSSL-VC9-32\include -L C:\Build-OpenSSL-VC9-32\lib -L "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib" -L C:\Python34\libs -l Gdi32 -l User32  -prefix C:\Qt\5.4.0 -mp
  17. nmake
  18. nmake install
  19. pause

附上文中改掉的cpp文件 找到对应位置自行修改
文件路径为qtmultimedia\src\plugins\directshow\camera\dscamerasession.cpp
  1. STDMETHODIMP_(ULONG) AddRef()
  2.     {
  3.         #if _MSC_VER==1500
  4.             volatile LONG *p_ref=reinterpret_cast<volatile LONG *>(&m_ref);
  5.             return InterlockedIncrement(p_ref);
  6.         #else
  7.             return InterlockedIncrement(&m_ref);
  8.         #endif
  9.     }
  10.     STDMETHODIMP_(ULONG) Release()
  11.     {
  12.         #if _MSC_VER==1500
  13.             volatile LONG *p_ref=reinterpret_cast<volatile LONG *>(&m_ref);
  14.             ULONG ref = InterlockedDecrement(p_ref);
  15.         #else
  16.             ULONG ref = InterlockedDecrement(&m_ref);
  17.         #endif
  18.         if (ref == 0)
  19.             delete this;
  20.         return ref;
  21.     }
完工
从此告别恼人的xp问题
唯一的缺陷是c++11支持不够好

离线stlcours

只看该作者 1楼 发表于: 2015-04-28
支持~~~
离线hidxl

只看该作者 2楼 发表于: 2015-09-11
为什么VS2008 编译不了webkit ,那个模块搞不定?
离线hidxl

只看该作者 3楼 发表于: 2015-09-16
VS2008 能编译 QT5.3,我已经编译出来了.
离线lion1986

只看该作者 4楼 发表于: 2015-09-24
按照你的方法编译5.5,部分模块编译成功,一部分出错(qttools 出错,其他依赖它的模块也编译不过去),错误如下,有谁知道什么原因?查了很久没查到什么原因导致的。

D:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xutility(263) : error C2678: 二进制“<”: 没有找到接受“const QString”类型的左操作数的运算符(或没有可接受的转换)
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qchar.h(533): 可能是“bool operator <(QChar,QChar)”[通过使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qbytearray.h(599): 或       “bool operator <(const QByteArray &,const QByteArray &)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qbytearray.h(601): 或       “bool operator <(const QByteArray &,const char *)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qbytearray.h(603): 或       “bool operator <(const char *,const QByteArray &)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qstring.h(625): 或       “bool operator <(const QString &,const QString &)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qstring.h(694): 或       “bool operator <(const char *,const QString &)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qstring.h(701): 或       “bool operator <(const char *,const QStringRef &)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qstring.h(1121): 或       “bool operator <(QLatin1String,QLatin1String)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qstring.h(1178): 或       “bool operator <(const char *,QLatin1String)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qstring.h(1504): 或       “bool operator <(const QStringRef &,const QStringRef &)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qcollator.h(72): 或       “bool operator <(const QCollatorSortKey &,const QCollatorSortKey &)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qelapsedtimer.h(80): 或       “bool operator <(const QElapsedTimer &,const QElapsedTimer &) throw()”[使用参数相关的查找找到]
        .\qhelpsearchindexwriter_clucene.cpp(329): 或       “bool fulltextsearch::clucene::operator <(const fulltextsearch::clucene::QTextHtmlEntity &,const QString &)”[使用参数相关的查找找到]
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qstring.h(632): 或       “bool QString::operator <(QLatin1String) const”
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qstring.h(680): 或       “bool QString::operator <(const char *) const”
        f:\qt\qt5\qtbase\include\qtcore\../../src/corelib/tools/qstring.h(687): 或       “bool QString::operator <(const QByteArray &) const”

离线lion1986

只看该作者 5楼 发表于: 2015-09-24
由于std::lower_bound导致的问题,已解决,方法如下:
在qttools\src\assistant\help\qhelpsearchindexwriter_clucene.cpp增加如下代码:
  1. #if defined(Q_CC_MSVC) && _MSC_VER < 1600
  2. //The STL implementation of MSVC 2008 requires the definitions
  3. static bool operator<(const QTextHtmlEntity &entity1, const QTextHtmlEntity &entity2)
  4. {
  5.     return QLatin1String(entity1.name) < QLatin1String(entity2.name);
  6. }
  7. static bool operator<(const QString &entityStr, const QTextHtmlEntity &entity)
  8. {
  9.     return entityStr < QLatin1String(entity.name);
  10. }
  11. #endif
在qt3d\src\render\backend\jobs\renderviewjobutils_p.h修改如下代码:
  1. struct ParameterInfo
  2. {
  3.     ParameterInfo(const QString &name = QString(), const QVariant &value = QVariant())
  4.         : name(name)
  5.         , value(value)
  6.     {}
  7.     QString name;
  8.     QVariant value;
  9.     bool operator<(const QString &otherName) const
  10.     {
  11.         return name < otherName;
  12.     }
  13.     bool operator<(const ParameterInfo &other) const
  14.     {
  15.         return name < other.name;
  16.     }
  17. };
  18. #if defined(Q_CC_MSVC) && _MSC_VER < 1600
  19. //The STL implementation of MSVC 2008 requires the definitions
  20. static bool operator<(const QString &name, const ParameterInfo &pi)
  21. {
  22.     return name < pi.name;
  23. }
  24. #endif




离线stlcours

只看该作者 6楼 发表于: 2015-10-02
有点意思,对于那些怀旧的老家伙们,确实用VS2008是一个好的选择~
离线hidxl

只看该作者 7楼 发表于: 2015-10-15
我编译 5.5 也没编译过去,牛X
快速回复
限100 字节
 
上一个 下一个