qt creator + vs2019编译记录

简介: 本文记录了作者在使用qt creator和vs2019编译项目时遇到的困难和解决方案,包括编译环境设置、qt creator编译脚本的成功案例、不带Ninja的编译脚本问题、错误示范以及相关参考链接。

一 编译环境

win10

python3.9

vs2019

二 qt creator编译脚本成功

一定记得打开

x64 Native Tools Command Prompt for VS

cd D:\\BaiduNetdiskDownload\\liulanqixiazai\\qtcreator_build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja -DCMAKE_PREFIX_PATH="C:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5;C:/libclang-release_140-based-windows-vs2019_64/libclang/lib/cmake/llvm"  D:\\BaiduNetdiskDownload\\liulanqixiazai\\qt-creator
cd D:\\BaiduNetdiskDownload\\liulanqixiazai\\qt-creator
cmake --build .

三 不带Nanja的qt creator编译脚本,不行

cd D:\\BaiduNetdiskDownload\\liulanqixiazai\\qtcreator_build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo  -DCMAKE_PREFIX_PATH="C:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5;C:/libclang-release_140-based-windows-vs2019_64/libclang/lib/cmake/llvm"  D:\\BaiduNetdiskDownload\\liulanqixiazai\\qt-creator
cd D:\\BaiduNetdiskDownload\\liulanqixiazai\\qt-creator
cmake -B .build

四 错误示范

cd D:\\BaiduNetdiskDownload\\liulanqixiazai\\qt-creator

cmake -S . -B .build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH="C:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5;C:/libclang-release_140-based-windows-vs2019_64/libclang/lib/cmake/llvm"

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.18363.

Clang build mode mismatch (debug vs release): limiting clangTooling

-- Found PythonLibs: C:/Users/pgjgg/AppData/Local/Programs/Python/Python39/libs/python39.lib (found suitable version "3.9.7", minimum required is "3.9")

-- Could NOT find elfutils (missing: ELFUTILS_INCLUDE_DIR ELFUTILS_LIB_dw ELFUTILS_LIB_elf)

-- PerfParser is disabled. Set ELFUTILS_INSTALL_DIR to enable it.

......

......

......

-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
DbgEngLib
linked by target "qtcreatorcdbext" in directory D:/BaiduNetdiskDownload/liulanqixiazai/qt-creator/src/libs/qtcreatorcdbext

-- Generating done
CMake Generate step failed. Build files cannot be regenerated correctly.

Could NOT find elfutils问题未能解决:

尝试如下:

qt-creator/Findelfutils.cmake at master · qt-creator/qt-creator (github.com)

pgjgg@DESKTOP-IQKLRIT MINGW64 /d/BaiduNetdiskDownload/liulanqixiazai/elfutils-latest.tar/elfutils-latest/elfutils-0.187
$ ./configure --enable-maintainer-mode && make && make check
configure: No --program-prefix given, using "eu-"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) no
checking build system type... x86_64-pc-mingw64
checking host system type... x86_64-pc-mingw64
checking whether make supports the include directive... no
checking for gcc... no
checking for cc... no
checking for cl.exe... cl.exe
checking whether the C compiler works... no
configure: error: in `/d/BaiduNetdiskDownload/liulanqixiazai/elfutils-latest.tar/elfutils-latest/elfutils-0.187':
configure: error: C compiler cannot create executables
See `config.log' for more details

再尝试:

./configure --enable-maintainer-mode && C:\\Qt\\Tools\\MinGW\\bin\\mingw32-make.exe && C:\\Qt\\Tools\\MinGW\\bin\\mingw32-make.exe check

无用,windows搞make,不会了。

生成成功qt creator,不能运行qt creator。

五 参考链接

qt-creator/qt-creator: A cross-platform Qt IDE (github.com)

qt/qt5: Qt5 super module (github.com)

记一次Qt 5.15源码编译 - 知乎 (zhihu.com)

ninja-build/ninja: a small build system with a focus on speed (github.com)

编译 Qt 5.15.x For Windows 基础教程 Visual Studio 2019 MSVC142 x64 - 芯片烤电池 - 博客园 (cnblogs.com)

qt5编译代码

@echo off

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"

pushd qt5

configure -prefix F:\qt\qt5\install -opensource -confirm-license -qt-sqlite -qt-pcre -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -opengl dynamic -skip qtwebengine -nomake tests -nomake examples -mp -release -optimize-size -strip
相关文章
|
19天前
|
C++
vtkdicom0.8_vtk9.2_dcmtk3.6.7_qt6.2编译OK
本文介绍了如何编译整合VTK 9.2、DICOM 0.8、DCMTK 3.6.7和Qt 6.2的步骤,包括安装Qt、CMake配置以及确认相关路径和版本设置。
vtkdicom0.8_vtk9.2_dcmtk3.6.7_qt6.2编译OK
|
19天前
|
Unix 网络虚拟化 C++
VS2022+Qt5.14.2成功编译MITK2022.10
使用VS2022和Qt5.14.2成功编译MITK2022.10的过程,包括编译结果的截图、遇到的编译问题的解决方法、两个重要的注意事项(patch文件格式的修改和ITK-gitclone-lastrun文件的存在),以及参考链接。文中详细描述了如何解决编译过程中遇到的错误C2220和警告C4819,以及如何修改文件编码和尾行格式。
VS2022+Qt5.14.2成功编译MITK2022.10
|
19天前
编译QCefView+VS2019+QT5.15.2
本文介绍了如何编译QCefView项目,并在VS2019和Qt 5.15.2环境下集成,包括编译结果、要点、cmake部署Qt的方法和相关参考链接。
编译QCefView+VS2019+QT5.15.2
|
19天前
|
人工智能 C++
初步编译QT5.15.2+VS2019+VTK8.2.0
本文介绍了在VS2019中编译QT 5.15.2和VTK 8.2.0的过程,包括编译结果、cmake库编译配置和cmake应用配置脚本,以及推荐的参考链接。
|
19天前
|
计算机视觉
vs2019_qt6.2.4_dcmtk3.6.7_vtk9.2.2_itk5.3_opencv4.6.0编译记录
这篇文章记录了使用VS2019编译Qt6.2.4、DCMTK3.6.7、VTK9.2.2、ITK5.3和OpenCV4.6.0的过程,包括下载和编译步骤,并提供了遇到编译错误时的解决方案和参考链接。
vs2019_qt6.2.4_dcmtk3.6.7_vtk9.2.2_itk5.3_opencv4.6.0编译记录
|
19天前
|
C语言 C++ Windows
QT多插件通信框架CTK编译记录
本文记录了编译QT多插件通信框架CTK的过程,包括编译结果截图、部署配置、Log4Qt编译配置、参考链接和拓展资料。文中提供了详细的编译步骤和配置文件示例,以及相关的资源链接。
QT多插件通信框架CTK编译记录
|
19天前
|
机器学习/深度学习 Java 计算机视觉
opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录
本文记录了使用mingw81_64编译OpenCV 4.5.5、Qt 5.15.2、VTK 9.1的详细过程,包括编译结果截图、编译步骤、遇到的问题及其解决方案,以及相关参考链接。文中还提到了如何编译boost源码为静态库,并提供了测试代码示例。
opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录
|
19天前
|
C语言
BOOST1.75+QT5.15.2编译记录
本文记录了BOOST 1.75与Qt 5.15.2编译过程的详细步骤,包括编译结果截图、将boost源码编译为静态库的步骤,以及如何在Qt项目中使用BOOST库的测试代码。文章还提供了相关参考链接,以帮助解决在编译和使用过程中可能遇到的问题。
BOOST1.75+QT5.15.2编译记录
|
3月前
|
数据安全/隐私保护 C++ 计算机视觉
Qt(C++)开发一款图片防盗用水印制作小工具
文本水印是一种常用的防盗用手段,可以将文本信息嵌入到图片、视频等文件中,用于识别和证明文件的版权归属。在数字化和网络化的时代,大量的原创作品容易被不法分子盗用或侵犯版权,因此加入文本水印成为了保护原创作品和维护知识产权的必要手段。 通常情况下,文本水印可以包含版权声明、制作者姓名、日期、网址等信息,以帮助识别文件的来源和版权归属。同时,为了增强防盗用效果,文本水印通常会采用字体、颜色、角度等多种组合方式,使得水印难以被删除或篡改,有效地降低了盗用意愿和风险。 开发人员可以使用图像处理技术和编程语言实现文本水印的功能,例如使用Qt的QPainter类进行文本绘制操作,将文本信息嵌入到图片中,
159 1
Qt(C++)开发一款图片防盗用水印制作小工具
|
2月前
|
监控 C++ 容器
【qt】MDI多文档界面开发
【qt】MDI多文档界面开发
58 0