当前位置: 首页 > news >正文

Qt源程序编译及错误问题解决

Error 5 while parsing C:/qt-everywhere-src-6.6.2/qt-build/qtdeclarative/src/qmlmodels/meta_types/qt6qmlmodels_release_metatypes.json: illegal value

.json 文件为空文件0字节,加 “[]”,不要引号。可以解决这类错误。

b372168416b24e5890b44f51aa870249.png

Qt编译

Qt for Windows - Building from Source | Qt 6.6

“https://doc.qt.io/qt-6/windows-building.html”

Qt for Windows - Building from Source

This page describes the process of configuring and building Qt for Windows. To download and install a pre-built Qt for Windows, follow the instructions on the Getting Started with Qt page.

Step 1: Getting the Sources

Qt sources can be installed in Qt Online Installer. Source packages are also available as Git repositories, as archives in the Qt Account (commercial users), and on download.qt.io (open-source users).

If you install the sources through Qt Online Installer, they will be available in the Qt installation directory, for instance C:\Qt\6.6.3\Src.

If you downloaded the source archive, extract it to a directory of your choice, for instance C:\dev\Qt\src.

Note: The path to the source directory must not contain any spaces or Windows-specific file system characters. The path should also be kept short. This prevents issues with too long file paths in the compilation phase.

Step 2: Installing Build Requirements and Set Environment

To build Qt from sources you need a build environment with a supported compiler and various build tools.

Build Tools

ToolSupported VersionsDescription
CMakeVersion 3.16 and newer (3.17 and newer for -debug-and-release builds 3.21 and newer for -static builds).Required for configuring the Qt build. Available in Qt Online Installer and on cmake.org.
Ninja-Recommended tool for building Qt. Available in Qt Online Installer and on ninja-build.org.
PythonVersion 3Required build tool. Windows installers are available on python.org, or from the Microsoft Store.

The executables cmake.exeninja.exe, and python.exe must be available in your build environment. Add the respective directory to your PATH environment variable.

Compilers

The following compilers and configurations are supported in Qt 6.6:

Operating SystemArchitectureCompiler
Windows 10 (1809 or later)x86_64MSVC 2022, MSVC 2019, MinGW 11.2 
Windows 11x86_64MSVC 2022, MSVC 2019, MinGW 11.2 
Windows on ARMarm64MSVC 2019/2022Technology Preview

Note: Windows on ARM is only supported as a deployment target. Applications have to be cross-compiled from an x86-64 Windows machine and deployed to target.

QDoc Dependencies

QDoc uses Clang to parse C++ code. If you wish to build QDoc manually, refer to Installing Clang for QDoc for specific build requirements.

Setting the Environment

For MSVC, do one of the following:

  • Run the vcvarsall.bat:
    "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64

     

  • Search on the Windows search bar for the VS Native Tools command prompt.

For MinGW: Add MinGW to PATH environment variable:

Set PATH=C:\qt\tools\mingw1120_64\bin;%PATH%

 

Step 3: Building the Qt Libraries and Tools

To configure your build, create a build directory and run the configure.bat script in this directory:

mkdir C:\dev\qt-build
cd C:\dev\qt-build
C:\dev\Qt\src\configure.bat

 

By default, Qt is configured for installation in the C:\Qt\Qt-6.5.3 directory. This can be changed by using the -prefix option. See the list of Qt Configure Options to tweak further.

Then build the libraries and tools:

cmake --build . --parallel

 

Period after --build means current folder.

After building, you need to install the libraries and tools in the desired path (unless you enabled a developer build:

cmake --install .

 

Step 4: Using Qt

After Qt is installed, you can start building applications with it.

If you work from the command line, consider adding the Qt tools to your PATH environment variable as follows:

set PATH=C:\Qt\Qt-6.5.3\bin;%PATH%

 

If you plan to use Qt from an IDE, you need to register the Qt version explicitly there. For Qt Creator, see Qt Creator: Adding Qt Versions.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

 

也可以:

cmake .. -G"CodeBlocks - MinGW Makefiles"

mingw32-make 或者mingw32-make -k 忽略错误

mingw32-make install 

最后,不知道的问题问问ChatGPT或者Kimi。

 

http://www.lryc.cn/news/329044.html

相关文章:

  • 作业练习(python)
  • Wireshark使用相关
  • 相机标定学习记录
  • CSS 滚动条样式修改
  • 谈谈配置中心?
  • 人工智能(pytorch)搭建模型25-基于pytorch搭建FPN特征金字塔网络的应用场景,模型结构介绍
  • JRT业务开发起步
  • 深度解析:国内主流音视频产品的核心功能与市场表现
  • 红黑树介绍及插入操作的实现
  • [linux初阶][vim-gcc-gdb] TwoCharter: gcc编译器
  • 单例设计模式(2)
  • boost::asio 启用 io_uring(Linux 5.10)队列支持
  • Android 自定义坐标曲线图(二)
  • 每日OJ题_子序列dp⑧_力扣446. 等差数列划分 II - 子序列
  • GOPROXY 代理设置
  • Redis面经
  • 【c++】类和对象(六)深入了解隐式类型转换
  • 什么是nginx正向代理和反向代理?
  • 【Go】面向萌新的Gin框架知识梳理学习笔记
  • baseDao增删改查.
  • 什么是面向对象【大白话Java面试题】
  • PyTorch 教程-快速上手指南
  • 【有芯职说】数字芯片BES工程师
  • 暴力破解pdf文档密码
  • 蓝桥杯刷题第四天
  • 03-数据库的用户管理
  • 每日一题 --- 三数之和[力扣][Go]
  • vue render 函数详解 (配参数详解)
  • ubuntu23.10配置RUST开发环境
  • Vue性能优化--gZip