VS2019编译VTK-9.1.0+Qt5.15.2

简介: 本文介绍了在VS2019和Qt 5.15.2环境下编译VTK 9.1.0的过程,包括成功编译无警告和错误的截图、修改的pro文件内容,以及在QML中加入VTK的失败尝试和参考链接。

1 QML运行结果

2 编译无警告和错误

3 修改pro文件

C/VTK/VTKTest at master · 975150313/C (github.com)

QT += quick quickcontrols2  qml
CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
msvc:QMAKE_CXXFLAGS += /utf-8
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

HEADERS += \
    qquickvtk.h \
    qquickvtkrenderer.h

SOURCES += main.cpp \
    qquickvtk.cpp \
    qquickvtkrenderer.cpp

RESOURCES += qml.qrc

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =

# Default rules for deployment.
qnx: target.path = /tmp/{
   mathJaxContainer[0]}{
   TARGET}/bin
!isEmpty(target.path): INSTALLS += target

INCLUDEPATH+="$$PWD"

#=====================================VTK_ITK===================================

INCLUDEPATH += "C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\include"
INCLUDEPATH += "C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\include\vtk-9.1"
INCLUDEPATH += "C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\include\vtk-9.1\vtkhdf5"

DEPENDPATH += "C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\bin"

DEPENDPATH += "C:\Qt\5.15.2\msvc2019_64\bin"

DEPENDPATH += "C:\Qt\5.15.2\msvc2019_64\qml"

#LIBS+= -L$$quote("C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib")

win32:LIBS += {
   mathJaxContainer[2]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkChartsCore-9.1.lib)
win32:LIBS += {
   mathJaxContainer[3]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkCommonComputationalGeometry-9.1.lib)
win32:LIBS += {
   mathJaxContainer[4]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkCommonDataModel-9.1.lib)
win32:LIBS += {
   mathJaxContainer[5]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkCommonMath-9.1.lib)
win32:LIBS += {
   mathJaxContainer[6]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkCommonPython-9.1.lib)
win32:LIBS += {
   mathJaxContainer[7]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkCommonTransforms-9.1.lib)
win32:LIBS += {
   mathJaxContainer[8]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkDomainsChemistry-9.1.lib)
win32:LIBS += {
   mathJaxContainer[9]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkdoubleconversion-9.1.lib)
win32:LIBS += {
   mathJaxContainer[10]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkexpat-9.1.lib)
win32:LIBS += {
   mathJaxContainer[11]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersCore-9.1.lib)
win32:LIBS += {
   mathJaxContainer[12]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersFlowPaths-9.1.lib)
win32:LIBS += {
   mathJaxContainer[13]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersGeneric-9.1.lib)
win32:LIBS += {
   mathJaxContainer[14]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersHybrid-9.1.lib)
win32:LIBS += {
   mathJaxContainer[15]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersImaging-9.1.lib)
win32:LIBS += {
   mathJaxContainer[16]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersParallel-9.1.lib)
win32:LIBS += {
   mathJaxContainer[17]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersPoints-9.1.lib)
win32:LIBS += {
   mathJaxContainer[18]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersPython-9.1.lib)
win32:LIBS += {
   mathJaxContainer[19]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersSMP-9.1.lib)
win32:LIBS += {
   mathJaxContainer[20]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersStatistics-9.1.lib)
win32:LIBS += {
   mathJaxContainer[21]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkFiltersTopology-9.1.lib)
win32:LIBS += {
   mathJaxContainer[22]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkfmt-9.1.lib)
win32:LIBS += {
   mathJaxContainer[23]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkGeovisCore-9.1.lib)
win32:LIBS += {
   mathJaxContainer[24]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkglew-9.1.lib)
win32:LIBS += {
   mathJaxContainer[25]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkGUISupportQtQuick-9.1.lib)
win32:LIBS += {
   mathJaxContainer[26]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkhdf5-9.1.lib)
win32:LIBS += {
   mathJaxContainer[27]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkImagingColor-9.1.lib)
win32:LIBS += {
   mathJaxContainer[28]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkImagingFourier-9.1.lib)
win32:LIBS += {
   mathJaxContainer[29]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkImagingHybrid-9.1.lib)
win32:LIBS += {
   mathJaxContainer[30]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkImagingMorphological-9.1.lib)
win32:LIBS += {
   mathJaxContainer[31]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkImagingStatistics-9.1.lib)
win32:LIBS += {
   mathJaxContainer[32]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkInfovisCore-9.1.lib)
win32:LIBS += {
   mathJaxContainer[33]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkInteractionImage-9.1.lib)
win32:LIBS += {
   mathJaxContainer[34]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkInteractionWidgets-9.1.lib)
win32:LIBS += {
   mathJaxContainer[35]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOAsynchronous-9.1.lib)
win32:LIBS += {
   mathJaxContainer[36]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOChemistry-9.1.lib)
win32:LIBS += {
   mathJaxContainer[37]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOCONVERGECFD-9.1.lib)
win32:LIBS += {
   mathJaxContainer[38]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOEnSight-9.1.lib)
win32:LIBS += {
   mathJaxContainer[39]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOExport-9.1.lib)
win32:LIBS += {
   mathJaxContainer[40]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOExportPDF-9.1.lib)
win32:LIBS += {
   mathJaxContainer[41]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOHDF-9.1.lib)
win32:LIBS += {
   mathJaxContainer[42]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOImport-9.1.lib)
win32:LIBS += {
   mathJaxContainer[43]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOIOSS-9.1.lib)
win32:LIBS += {
   mathJaxContainer[44]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOLSDyna-9.1.lib)
win32:LIBS += {
   mathJaxContainer[45]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOMotionFX-9.1.lib)
win32:LIBS += {
   mathJaxContainer[46]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIONetCDF-9.1.lib)
win32:LIBS += {
   mathJaxContainer[47]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOParallel-9.1.lib)
win32:LIBS += {
   mathJaxContainer[48]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOPLY-9.1.lib)
win32:LIBS += {
   mathJaxContainer[49]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOSQL-9.1.lib)
win32:LIBS += {
   mathJaxContainer[50]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOTecplotTable-9.1.lib)
win32:LIBS += {
   mathJaxContainer[51]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOVideo-9.1.lib)
win32:LIBS += {
   mathJaxContainer[52]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkIOXMLParser-9.1.lib)
win32:LIBS += {
   mathJaxContainer[53]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkjsoncpp-9.1.lib)
win32:LIBS += {
   mathJaxContainer[54]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtklibharu-9.1.lib)
win32:LIBS += {
   mathJaxContainer[55]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtklibxml2-9.1.lib)
win32:LIBS += {
   mathJaxContainer[56]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtklz4-9.1.lib)
win32:LIBS += {
   mathJaxContainer[57]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkmetaio-9.1.lib)
win32:LIBS += {
   mathJaxContainer[58]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkogg-9.1.lib)
win32:LIBS += {
   mathJaxContainer[59]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkParallelDIY-9.1.lib)
win32:LIBS += {
   mathJaxContainer[60]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkpugixml-9.1.lib)
win32:LIBS += {
   mathJaxContainer[61]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkPythonInterpreter-9.1.lib)
win32:LIBS += {
   mathJaxContainer[62]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkRenderingContext2D-9.1.lib)
win32:LIBS += {
   mathJaxContainer[63]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkRenderingCore-9.1.lib)
win32:LIBS += {
   mathJaxContainer[64]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkRenderingGL2PSOpenGL2-9.1.lib)
win32:LIBS += {
   mathJaxContainer[65]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkRenderingLabel-9.1.lib)
win32:LIBS += {
   mathJaxContainer[66]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkRenderingOpenGL2-9.1.lib)
win32:LIBS += {
   mathJaxContainer[67]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkRenderingSceneGraph-9.1.lib)
win32:LIBS += {
   mathJaxContainer[68]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkRenderingVolume-9.1.lib)
win32:LIBS += {
   mathJaxContainer[69]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkRenderingVtkJS-9.1.lib)
win32:LIBS += {
   mathJaxContainer[70]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtksys-9.1.lib)
win32:LIBS += {
   mathJaxContainer[71]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtktheora-9.1.lib)
win32:LIBS += {
   mathJaxContainer[72]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkverdict-9.1.lib)
win32:LIBS += {
   mathJaxContainer[73]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkViewsCore-9.1.lib)
win32:LIBS += {
   mathJaxContainer[74]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkViewsQt-9.1.lib)
win32:LIBS += {
   mathJaxContainer[75]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkWrappingTools-9.1.lib)
win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-9.1.0\VTK-release\lib\vtkzlib-9.1.lib)



#=====================================VTK_ITK===================================

4 QML加VTK的失败尝试

nicanor-romero/QtVtk: An integration between Qt Quick Controls 2 and VTK for 3D rendering (github.com)

​​​​​​

报错:

qrc:/resources/main.qml:191: ReferenceError: fileUrl is not defined

在VS2019和QT5.15.2进行debug,没有解决。

尝试了如下方法:

import Qt.labs.platform 1.1

canvasHandler.openModel(file);

// bool isModelExtensionValid(const QUrl &modelPath) const;

bool isModelExtensionValid( QUrl modelPath) ;

类似的:

FONQRI/VtkWithQmlExample: This is an example of loading and showing STL files with VTK and integration with QML. (github.com)

5 参考链接

(600条消息) 初步编译QT5.15.2+VS2019+VTK8.1.0_yantuguiguziPGJ的博客-CSDN博客

(587条消息) 三战VS2019编译VTK7.1+Qt5.15.2_yantuguiguziPGJ的博客-CSDN博客

(587条消息) VTK笔记-Qt5.12.11编译VTK9.0.3-QVTKOpenGLNativeWidget_黑山老妖的博客-CSDN博客

(587条消息) QQuick Vtk QML C++_douzi949389的博客-CSDN博客

(600条消息) VTK9.1.0在Windows10+VS2019+Qt 5.15.2环境下编译安装以及VTK应用于QT_isongxw的博客-CSDN博客

相关文章
|
2月前
|
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
|
2月前
|
Unix 网络虚拟化 C++
VS2022+Qt5.14.2成功编译MITK2022.10
使用VS2022和Qt5.14.2成功编译MITK2022.10的过程,包括编译结果的截图、遇到的编译问题的解决方法、两个重要的注意事项(patch文件格式的修改和ITK-gitclone-lastrun文件的存在),以及参考链接。文中详细描述了如何解决编译过程中遇到的错误C2220和警告C4819,以及如何修改文件编码和尾行格式。
118 1
VS2022+Qt5.14.2成功编译MITK2022.10
|
2月前
编译QCefView+VS2019+QT5.15.2
本文介绍了如何编译QCefView项目,并在VS2019和Qt 5.15.2环境下集成,包括编译结果、要点、cmake部署Qt的方法和相关参考链接。
117 1
编译QCefView+VS2019+QT5.15.2
|
2月前
|
人工智能 C++
初步编译QT5.15.2+VS2019+VTK8.2.0
本文介绍了在VS2019中编译QT 5.15.2和VTK 8.2.0的过程,包括编译结果、cmake库编译配置和cmake应用配置脚本,以及推荐的参考链接。
110 4
|
2月前
|
计算机视觉
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编译记录
|
2月前
|
C语言 C++ Windows
QT多插件通信框架CTK编译记录
本文记录了编译QT多插件通信框架CTK的过程,包括编译结果截图、部署配置、Log4Qt编译配置、参考链接和拓展资料。文中提供了详细的编译步骤和配置文件示例,以及相关的资源链接。
QT多插件通信框架CTK编译记录
|
2月前
|
机器学习/深度学习 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编译记录
|
2月前
|
C语言
BOOST1.75+QT5.15.2编译记录
本文记录了BOOST 1.75与Qt 5.15.2编译过程的详细步骤,包括编译结果截图、将boost源码编译为静态库的步骤,以及如何在Qt项目中使用BOOST库的测试代码。文章还提供了相关参考链接,以帮助解决在编译和使用过程中可能遇到的问题。
BOOST1.75+QT5.15.2编译记录
|
2月前
|
IDE 开发工具 C++
qt creator + vs2019编译记录
本文记录了作者在使用qt creator和vs2019编译项目时遇到的困难和解决方案,包括编译环境设置、qt creator编译脚本的成功案例、不带Ninja的编译脚本问题、错误示范以及相关参考链接。
qt creator + vs2019编译记录
|
4月前
|
数据安全/隐私保护 C++ 计算机视觉
Qt(C++)开发一款图片防盗用水印制作小工具
文本水印是一种常用的防盗用手段,可以将文本信息嵌入到图片、视频等文件中,用于识别和证明文件的版权归属。在数字化和网络化的时代,大量的原创作品容易被不法分子盗用或侵犯版权,因此加入文本水印成为了保护原创作品和维护知识产权的必要手段。 通常情况下,文本水印可以包含版权声明、制作者姓名、日期、网址等信息,以帮助识别文件的来源和版权归属。同时,为了增强防盗用效果,文本水印通常会采用字体、颜色、角度等多种组合方式,使得水印难以被删除或篡改,有效地降低了盗用意愿和风险。 开发人员可以使用图像处理技术和编程语言实现文本水印的功能,例如使用Qt的QPainter类进行文本绘制操作,将文本信息嵌入到图片中,
176 1
Qt(C++)开发一款图片防盗用水印制作小工具