2023年12月24日发(作者:)

编译Qt64位_for_VS2010_with_Qt5.1.1

李刚_2014/7/3

编译时所用系统环境:Win7 x64 英文版

一、

参考文档:

1. /wwwslcomcn/article/details/8363886

2. /?title=Building_Qt_on_Windows_(VC%2B%2B_2010)

二、

所准备程序或环境:

1、Qt源文件(注意是源文件,不是安装包)

/archive/qt/5.1/5.1.1/single/

2、Windows SDK 7.1

/en-us/download/?id=8442

注意选择GRMSDKX_EN_

3、Directx SDK

/en-us/download/?id=6812

4、Python64位 本次编译使用Python 2.7.7

/download/releases/2.7.7/

5、微软的一个补丁:KB2280741

/KB2280741

(下载链接错误,应该是不能用)

三、

后面所有的命令行操作都是在Windows SDK 7.1 Command Prompt中进行的(管理员权限)

软件安装步骤:

1、安装Windows SDK时,不要勾选Visual C++ compiler,否则安装会报错。

安装Windows SDK7.1时发生的一个错误:

A problem occurred while installing selected Windows SDK components.

Installation of the "Microsoft Windows SDK for Windows 7" product has reported the following

error: Please refer to document for further information.

Please attempt to resolve the problem and then start Windows SDK setup again. If you continue

to have problems with this issue, please visit the SDK team support page at

/fwlink/?LinkId=130245.

Click the View Log button to review the installation log.

To exit, click Finish.

解决办法:卸载vc2010 X86 Redistributable 10.0.4及以上版本,然后重新安装,经测试,成功安装。

2、安装KB2280741

3、安装DX SDK

装完DX SDK后,先在Windows SDK 7.1 Command Prompt下进行下面的操作,不要等编译报错了再进行:

c:Program FilesMicrosoft SDKsWindowsv7.1BinNETFX 4.0 Tools>copy

c:Program FilesMicrosoft SDKsWindowsv7.1BinNETFX 4.0 Tools>copy

4、安装Python

配置Python的环境变量(好像还是出错,我是将放到C:WindowsSystem32里面才没有报错)

四、

编译步骤

1、

C:Program FilesMicrosoft SDKsWindowsv7.1>echo %PATH%

2、进入Directx SDK的安装目录

bindx_ AMD64

3、进入Qt的解压目录

例如I:qt511_64_612configure -debug-and-release -static -platform win32-msvc2010 -qt-libpng

-qt-libjpeg -no-freetype -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -nomake examples

-nomake tools -opengl desktop -no-icu -mp

Qt配置选项含义

/dztaopao/article/details/9243269

也可以运行 configure –help 查看

之后选择LGPL,Yes 成功后nmake

过程中如果没有报错则编译成功

在vs里使用add-in配置一下qt目录即可。

五、

编译成功后配置工程注意事项:

1、工程配置 C++>>Preprocessor>>Preprocessor Definitions

QT_CORE_LIB

QT_GUI_LIB

QT_WIDGETS_LIB

UNICODE

WIN64

Q_OS_WIN

QT_HELP_LIB

QT_DLL

2、如果提示与3rd中的zlib重定义

Linker>>Command Line >>Additional Options

/FORCE:MULTIPLE

3、链接的lib中要添加

Ws2_

不添加会报错。

4、

#ifdef WIN64

#include

Q_IMPORT_PLUGIN (QWindowsIntegrationPlugin);

#endif

其他配置可参考平台求面板或是平面板的配置(64)