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博客

相关文章
|
11天前
|
弹性计算 人工智能 架构师
阿里云携手Altair共拓云上工业仿真新机遇
2024年9月12日,「2024 Altair 技术大会杭州站」成功召开,阿里云弹性计算产品运营与生态负责人何川,与Altair中国技术总监赵阳在会上联合发布了最新的“云上CAE一体机”。
阿里云携手Altair共拓云上工业仿真新机遇
|
8天前
|
机器学习/深度学习 算法 大数据
【BetterBench博士】2024 “华为杯”第二十一届中国研究生数学建模竞赛 选题分析
2024“华为杯”数学建模竞赛,对ABCDEF每个题进行详细的分析,涵盖风电场功率优化、WLAN网络吞吐量、磁性元件损耗建模、地理环境问题、高速公路应急车道启用和X射线脉冲星建模等多领域问题,解析了问题类型、专业和技能的需要。
2521 17
【BetterBench博士】2024 “华为杯”第二十一届中国研究生数学建模竞赛 选题分析
|
7天前
|
机器学习/深度学习 算法 数据可视化
【BetterBench博士】2024年中国研究生数学建模竞赛 C题:数据驱动下磁性元件的磁芯损耗建模 问题分析、数学模型、python 代码
2024年中国研究生数学建模竞赛C题聚焦磁性元件磁芯损耗建模。题目背景介绍了电能变换技术的发展与应用,强调磁性元件在功率变换器中的重要性。磁芯损耗受多种因素影响,现有模型难以精确预测。题目要求通过数据分析建立高精度磁芯损耗模型。具体任务包括励磁波形分类、修正斯坦麦茨方程、分析影响因素、构建预测模型及优化设计条件。涉及数据预处理、特征提取、机器学习及优化算法等技术。适合电气、材料、计算机等多个专业学生参与。
1522 15
【BetterBench博士】2024年中国研究生数学建模竞赛 C题:数据驱动下磁性元件的磁芯损耗建模 问题分析、数学模型、python 代码
|
3天前
|
存储 关系型数据库 分布式数据库
GraphRAG:基于PolarDB+通义千问+LangChain的知识图谱+大模型最佳实践
本文介绍了如何使用PolarDB、通义千问和LangChain搭建GraphRAG系统,结合知识图谱和向量检索提升问答质量。通过实例展示了单独使用向量检索和图检索的局限性,并通过图+向量联合搜索增强了问答准确性。PolarDB支持AGE图引擎和pgvector插件,实现图数据和向量数据的统一存储与检索,提升了RAG系统的性能和效果。
|
10天前
|
编解码 JSON 自然语言处理
通义千问重磅开源Qwen2.5,性能超越Llama
击败Meta,阿里Qwen2.5再登全球开源大模型王座
581 14
|
1月前
|
运维 Cloud Native Devops
一线实战:运维人少,我们从 0 到 1 实践 DevOps 和云原生
上海经证科技有限公司为有效推进软件项目管理和开发工作,选择了阿里云云效作为 DevOps 解决方案。通过云效,实现了从 0 开始,到现在近百个微服务、数百条流水线与应用交付的全面覆盖,有效支撑了敏捷开发流程。
19283 30
|
10天前
|
人工智能 自动驾驶 机器人
吴泳铭:AI最大的想象力不在手机屏幕,而是改变物理世界
过去22个月,AI发展速度超过任何历史时期,但我们依然还处于AGI变革的早期。生成式AI最大的想象力,绝不是在手机屏幕上做一两个新的超级app,而是接管数字世界,改变物理世界。
484 49
吴泳铭:AI最大的想象力不在手机屏幕,而是改变物理世界
|
1月前
|
人工智能 自然语言处理 搜索推荐
阿里云Elasticsearch AI搜索实践
本文介绍了阿里云 Elasticsearch 在AI 搜索方面的技术实践与探索。
18841 20
|
1月前
|
Rust Apache 对象存储
Apache Paimon V0.9最新进展
Apache Paimon V0.9 版本即将发布,此版本带来了多项新特性并解决了关键挑战。Paimon自2022年从Flink社区诞生以来迅速成长,已成为Apache顶级项目,并广泛应用于阿里集团内外的多家企业。
17530 13
Apache Paimon V0.9最新进展
|
2天前
|
云安全 存储 运维
叮咚!您有一份六大必做安全操作清单,请查收
云安全态势管理(CSPM)开启免费试用
365 4
叮咚!您有一份六大必做安全操作清单,请查收