1 编译结果
2 正确的配置
3 爬坑记录
3.1 未勾选QT,重头编译
C:\Qt\5.15.2\msvc2019_64\lib\cmake\Qt5
C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1/VTK-res
3.2 OPENGL2需要变为 OPENGL,重头编译
OPENGL2,则示例代码会出现如下缺库:
:-1: error: LNK1181: 无法打开输入文件“C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-release\lib\vtkGUISupportQtOpenGL-7.1.lib”
:-1: error: LNK1181: 无法打开输入文件“C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-release\lib\vtkproj4-7.1_d.lib”
:-1: error: LNK1181: 无法打开输入文件“C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-release\lib\vtkRenderingContextOpenGL-7.1.lib”
:-1: error: LNK1181: 无法打开输入文件“C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-release\lib\vtkRenderingGL2PS-7.1.lib”
:-1: error: LNK1181: 无法打开输入文件“C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-release\lib\vtkRenderingLabel-7.1.lib”
:-1: error: LNK1181: 无法打开输入文件“C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-release\lib\vtkRenderingLIC-7.1.lib”
:-1: error: LNK1181: 无法打开输入文件“C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-release\lib\vtkRenderingOpenGL-7.1.lib”
3.3 正确配置,编译有错误,不影响例子
xianyunxiaohe/VTK: vtk的学习 (github.com)
3.4 修改后的pro文件
#-------------------------------------------------
#
# Project created by QtCreator 2017-09-28T12:03:12
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = testQtVTK7
TEMPLATE = app
INCLUDEPATH += cn.thu.bean \
cn.thu.ihm \
cn.thu.lib\
cn.thu.math\
cn.thu.test
SOURCES += \
main.cpp \
cn.thu.test/TestVTK.cpp \
cn.thu.ihm/widget.cpp
HEADERS += \
cn.thu.test/TestVTK.h \
cn.thu.ihm/widget.h
INCLUDEPATH += "C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\include\vtk-7.1"
INCLUDEPATH += "C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\include\vtk-7.1\vtkhdf5"
win32:LIBS += {
mathJaxContainer[0]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkChartsCore-7.1.lib)
win32:LIBS += {
mathJaxContainer[1]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkCommonComputationalGeometry-7.1.lib)
win32:LIBS += {
mathJaxContainer[2]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkCommonDataModel-7.1.lib)
win32:LIBS += {
mathJaxContainer[3]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkCommonMath-7.1.lib)
win32:LIBS += {
mathJaxContainer[4]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkCommonSystem-7.1.lib)
win32:LIBS += {
mathJaxContainer[5]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkDICOMParser-7.1.lib)
win32:LIBS += {
mathJaxContainer[6]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkexoIIc-7.1.lib)
win32:LIBS += {
mathJaxContainer[7]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersAMR-7.1.lib)
win32:LIBS += {
mathJaxContainer[8]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersExtraction-7.1.lib)
win32:LIBS += {
mathJaxContainer[9]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersGeneral-7.1.lib)
win32:LIBS += {
mathJaxContainer[10]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersGeometry-7.1.lib)
win32:LIBS += {
mathJaxContainer[11]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersHyperTree-7.1.lib)
win32:LIBS += {
mathJaxContainer[12]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersModeling-7.1.lib)
win32:LIBS += {
mathJaxContainer[13]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersParallelImaging-7.1.lib)
win32:LIBS += {
mathJaxContainer[14]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersProgrammable-7.1.lib)
win32:LIBS += {
mathJaxContainer[15]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersSMP-7.1.lib)
win32:LIBS += {
mathJaxContainer[16]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersStatistics-7.1.lib)
win32:LIBS += {
mathJaxContainer[17]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkFiltersVerdict-7.1.lib)
win32:LIBS += {
mathJaxContainer[18]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkGeovisCore-7.1.lib)
win32:LIBS += {
mathJaxContainer[19]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkGUISupportQt-7.1.lib)
win32:LIBS += {
mathJaxContainer[20]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkGUISupportQtSQL-7.1.lib)
win32:LIBS += {
mathJaxContainer[21]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkhdf5_hl-7.1.lib)
win32:LIBS += {
mathJaxContainer[22]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkImagingCore-7.1.lib)
win32:LIBS += {
mathJaxContainer[23]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkImagingGeneral-7.1.lib)
win32:LIBS += {
mathJaxContainer[24]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkImagingMath-7.1.lib)
win32:LIBS += {
mathJaxContainer[25]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkImagingSources-7.1.lib)
win32:LIBS += {
mathJaxContainer[26]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkImagingStencil-7.1.lib)
win32:LIBS += {
mathJaxContainer[27]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkInfovisLayout-7.1.lib)
win32:LIBS += {
mathJaxContainer[28]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkInteractionStyle-7.1.lib)
win32:LIBS += {
mathJaxContainer[29]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOAMR-7.1.lib)
win32:LIBS += {
mathJaxContainer[30]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOEnSight-7.1.lib)
win32:LIBS += {
mathJaxContainer[31]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOExport-7.1.lib)
win32:LIBS += {
mathJaxContainer[32]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOImage-7.1.lib)
win32:LIBS += {
mathJaxContainer[33]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOInfovis-7.1.lib)
win32:LIBS += {
mathJaxContainer[34]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOLSDyna-7.1.lib)
win32:LIBS += {
mathJaxContainer[35]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOMovie-7.1.lib)
win32:LIBS += {
mathJaxContainer[36]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOParallel-7.1.lib)
win32:LIBS += {
mathJaxContainer[37]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOPLY-7.1.lib)
win32:LIBS += {
mathJaxContainer[38]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOTecplotTable-7.1.lib)
win32:LIBS += {
mathJaxContainer[39]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkIOXML-7.1.lib)
win32:LIBS += {
mathJaxContainer[40]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkjpeg-7.1.lib)
win32:LIBS += {
mathJaxContainer[41]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtklibxml2-7.1.lib)
win32:LIBS += {
mathJaxContainer[42]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkNetCDF-7.1.lib)
win32:LIBS += {
mathJaxContainer[43]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkoggtheora-7.1.lib)
win32:LIBS += {
mathJaxContainer[44]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkpng-7.1.lib)
win32:LIBS += {
mathJaxContainer[45]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingAnnotation-7.1.lib)
#win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingContext2D-7.1.lib)
win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingContextOpenGL-7.1.lib)
win32:LIBS += {
mathJaxContainer[47]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingFreeType-7.1.lib)
win32:LIBS += {
mathJaxContainer[48]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingImage-7.1.lib)
#win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingLabel-7.1.lib)
win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingLIC-7.1.lib)
win32:LIBS += {
mathJaxContainer[50]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingOpenGL-7.1.lib)
#win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingQt-7.1.lib)
win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingVolume-7.1.lib)
#win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkRenderingVolumeOpenGL-7.1.lib)
win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtksqlite-7.1.lib)
win32:LIBS += {
mathJaxContainer[53]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtktiff-7.1.lib)
win32:LIBS += {
mathJaxContainer[54]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkViewsContext2D-7.1.lib)
win32:LIBS += {
mathJaxContainer[55]}quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkViewsInfovis-7.1.lib)
#win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkViewsQt-7.1.lib)
win32:LIBS += $$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\lib\vtkzlib-7.1.lib)
win32:LIBS += -L$$quote(C:\Users\pgjgg\Desktop\C++_learn\VTK-7.1.1\VTK-debug\bin)
4 参考链接
(600条消息) 初步编译QT5.15.2+VS2019+VTK8.1.0_yantuguiguziPGJ的博客-CSDN博客
(600条消息) VS2019编译VTK-9.1.0+Qt5.15.2_yantuguiguziPGJ的博客-CSDN博客