【失败】2024年,使用C++从0开始编译QT源码

2024年,使用C++从0开始编译QT源码

背景:

  • 由于工作需要,必须使用VS2010(对应编译链MSVC100);

  • 由于工作需要,必须进行64的编译;

  • QT官网把大陆的IP地址给封禁了,导致无法下载qt-opensource-windows-x86-msvc2010_opengl-5.4.2.exe(即使科学了,但是非常蛋疼的是官网只提供了x86 32位的动态库)

  • 虽然热心网友提供了64位的qt-5.5.0-x64-mingw510r0-seh-rev0.exe,但是编译链是mingw不是MSVC100。跟现有的技术代码不能很好的兼容;

  • 综上所述,必须要学会自己编译QT的源码; (MSVC100+64BIT)

1、编译QT源码;

  1. Visual C++ 2010 contains all necessary SDKs for Qt compilation. However if you plan to use Qt with Phonon you need to install DirectX SDK first.

  2. Install Perl if you are going to compile Qt >= 4.8.0

    https://strawberryperl.com/

    ActivePerl 他们家的东西,下载不到,因为无法访问亚马逊服务器。

  1. Download and extract Qt 4.7.1 Source Code. (Qt 4.8.0 or Latest snapshot).

    https://download.qt.io/new_archive/qt/5.4/5.4.0/single/qt-everywhere-opensource-src-5.4.0.zip
  1. Copy contents of the folder qt-everywhere-opensource-src-4.7.1 to the directory where you intend to install Qt. In our case this is C:\Qt\4.7.1.

  2. Set up environmental variables QTDIR=C:\Qt\4.7.1QMAKESPEC=win32-msvc2010

  3. Update PATH variable to include %QTDIR%\bin

  4. Download the latest version of jom.

  5. Extract jom files to C:\Qt\jom folder

  6. Start Visual Studio 2010 Command Prompt: Start > Programs > Microsoft Visual Studio 2010 > Visual Studio Tools > Visual Studio Command Prompt.

  7. Run following commands in it (every line is a different command: type it then press Enter

   cd c:\Qt\4.7.1
   configure -debug-and-release -opensource -platform win32-msvc2010
   ..\jom\jom.exe -j N

Where N is number of CPU cores you want to utilize for Qt compilation. Larger is better.

  1. Download and install Qt Visual Studio Add-in.

  2. Run Visual Studio 2010. Integrate just compiled Qt to IDE using menu Qt > Qt Options > Qt Versions > Add

参考:

http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/#comment-7546

尝试了很长时间,还是失败,太难了。

Perl版本不对?

2、利用编译后的QT库,构建自己的GUI界面;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值