使用VS2019编译Qt4.8.7 x64的笔记

使用VS2019编译Qt4.8.7 x64的笔记


Qt4.8的configure参数列表:https://doc.qt.io/archives/qt-4.8/configure-options.html
注意不同版本的配置参数可能是有差异的,特别是Qt5与Qt4之间的差异非常大。网上有些配置参数:-nomake、-confirm-license、-qt-sqlite等,对于Qt4.8来说是不支持的,所以我们在配置configure参数的时候需要特别注意甄别,实际上将几个主要的参数配置完整就OK,包括: -make nmake -platform win32-msvc2019 -debug-and-release -opensource -prefix “C:\Qt4\4.8.7\msvc2019_64”,-mp:Use multiple processors for compiling with MSVC,-static:静态库(默认情况下是-shared),第三方库参数:-qt-zlib -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg等。

1:配置configure命令参数

以下是我采用VS2019编译Qt4.8.7的configure参数设置

编译64位的qt配置参数(x64 Native Tools Command Prompt for VS 2019,在打开的终端cd到qt源码目录-源码中bin、mkspecs、qmake、src等文件夹所在目录-利用configure命令配置编译选项)

configure -make nmake -platform win32-msvc2019 -debug-and-release -opensource -prefix “C:\Qt4\4.8.7\msvc2019_64” -nomake examples -nomake tests -nomake docs -nomake demos -qt-zlib -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg

说明:-debug-and-release:生成debug和release模式的两种库,-opensource:Compile and link the Open-Source Edition of Qt,参数-nomake examples -nomake tests -nomake docs -nomake demos:表示不编译相关模块(Qt4.8.7不支持,但是不影响namke编译),参数-qt-zlib -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg:表示编译第三方模块

编译32为的qt配置参数(x86 Native Tools Command Prompt for VS 2019,在打开的终端cd到qt源码目录-源码中bin、mkspecs、qmake、src等文件夹所在目录-利用configure命令配置编译选项)

configure -make nmake -platform win32-msvc2019 -debug-and-release -opensource -prefix “C:\Qt4\4.8.7\msvc2019” -nomake examples -nomake tests -nomake docs -nomake demos -qt-zlib -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg

配置完成继续输入以下命令:

2:nmake

执行编译

3:nmake install

安装-将编译好的文件安装到-prefix参数设置目录下

如果需要重新编译,可以采用nmake confclean命令清理编译产生的中间文件。建议,编译-安装完成后都使用该命令清除相关中间文件。

Qt is now configured for building. Just run nmake.
To reconfigure, run nmake confclean and configure.

使用vs2019编译出来的qmake加入vs2019中无法新建工程,但是使用qtcreator可以正常使用。将qtcreator建立的工程采用pro的方式导入vs2019同样失败,错误是插件不支持qt4的版本。

  • 23
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
以下是使用gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz交叉编译qt4.8.7的流程: 1. 下载并解压gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz和qt-everywhere-opensource-src-4.8.7.tar.gz 2. 配置环境变量,将交叉编译工具链的路径添加到PATH中: ``` export PATH=/path/to/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin:$PATH ``` 3. 进入qt-everywhere-opensource-src-4.8.7目录,运行./configure命令,配置Qt编译选项: ``` ./configure -embedded arm -xplatform qws/linux-arm-gnueabi-g++ -prefix /usr/local/qt4.8.7-arm -no-gfx-linuxfb -no-gfx-multiscreen -no-gfx-transformed -depths all -no-qt3support -no-scripttools -no-openssl -no-nis -no-cups -no-iconv -no-pch -no-dbus -no-phonon -no-opengl -no-javascript-jit -no-webkit -no-qml-debug -no-separate-debug-info -no-exceptions -no-accessibility -no-script -no-stl -no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon-backend -no-webkit-qml-plugin -no-declarative -no-declarative-debug -no-gif -no-libtiff -no-mng -no-openssl -no-glib -no-pulseaudio -no-gstreamer -no-alsa -no-sm -no-xinerama -no-xkb -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xshape -no-xinput -no-xkbcommon -no-xcb -no-xlib -no-kms -no-linuxfb -no-directfb -no-gfx-qvfb -no-largefile -no-nas-sound -no-webkitwidgets -no-javascriptcore -no-script -no-scripttools -no-xmlpatterns -no-svg -no-webkit -no-qml-debug -no-separate-debug-info -no-icu -no-openssl -no-sql-sqlite -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-tds -no-tls ``` 参数说明: -embedded arm:选择Qt的嵌入式编译模式。 -xplatform qws/linux-arm-gnueabi-g++:指定交叉编译器和Qt平台的路径。 -prefix /usr/local/qt4.8.7-arm:指定Qt的安装路径。 其他参数是为了禁用不需要的模块和功能。 4. 运行make命令进行编译: ``` make ``` 5. 编译完成后,运行make install命令进行安装: ``` make install ``` 6. 将交叉编译后的Qt库拷贝到目标设备上,将头文件和库文件添加到交叉编译环境的搜索路径中。 7. 在交叉编译环境中使用qmake编译Qt应用程序: ``` /path/to/qt4.8.7-arm/bin/qmake make ``` 以上就是使用gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz交叉编译qt4.8.7的流程。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值