当将qt项目移动到另一个电脑端的vs中时,需要的配置。
1.需要下载的软件:
Visual Studio 、Qt Creator 、VTK 、CMake
2.软件的安装
这个可以参考其他相关博客,这里不再赘述
Qt5.14.2下载与安装(保姆级图文教程)[通俗易懂]-腾讯云开发者社区-腾讯云 (tencent.com)
Windows下CMake的下载与安装详解_cmake下载-CSDN博客
VTK+VS2019(或其他版本均可) 傻瓜式一站式 配置_vtk的debug和release能用同一个dll吗-CSDN博客
3.配置环境变量
新增环境变量path,一直点击确定
Qt环境变量
D:\Qt\5.12.11\msvc2017_64\bin
CMake环境变量
我的环境变量:D:\CMake\bin
VTK环境变量
我的环境变量:D:\VTK\bin
3.VS环境配置Qt\VTK\CMake
1.配置Qt
在vs中安装qt插件
打开vs,上面的工具栏选择 扩展->管理扩展
搜索栏里面输入qt
选择qt visual studio tools 安装
等待安装完成
重启vs
选择 扩展->qt vs tools->Options,打开
新增qt的bin文件路径
如我的文件路径是:D:\Qt\5.12.11\msvc2017_64\bin
选择该路径
项目配置qt installation
2.配置VTK
打开 调试->调试属性 ->VC++目录,需要更改包含目录和库目录
将这两个目录都改为VTK中include下的vtk版本的目录
如我的是:D:\VTK\include\vtk-9.3
即
将VTK底下bin文件中的 .dll 文件拷贝到 C:\WINDOWS\system32中
如果bin底下有debug和release两种文件夹,选择你使用的编译器的文件夹下的.dll进行复制即可
3.添加VTK依赖项
将lib复制到VTK中
可以按照下面执行复制,也可以直接跳到最后一步里面有需要复制的内容
打开终端命令行(Win + R),输入cmd,回车
输入命令
d: cd D:\VTK\lib\Debug dir *.lib /w dir *.lib /w > D:\vtk-libs.txt
打开该txt文件,删掉多余内容
全选(Alt + A)文件内容复制(Ctrl + C)
或者直接复制以下内容也可
vtkcgns-9.3d.lib
vtkChartsCore-9.3d.lib
vtkCommonColor-9.3d.lib
vtkCommonComputationalGeometry-9.3d.lib
vtkCommonCore-9.3d.lib
vtkCommonDataModel-9.3d.lib
vtkCommonExecutionModel-9.3d.lib
vtkCommonImplicitArrays-9.3d.lib
vtkCommonMath-9.3d.lib
vtkCommonMisc-9.3d.lib
vtkCommonSystem-9.3d.lib
vtkCommonTransforms-9.3d.lib
vtkDICOMParser-9.3d.lib
vtkDomainsChemistry-9.3d.lib
vtkDomainsChemistryOpenGL2-9.3d.lib
vtkdoubleconversion-9.3d.lib
vtkexodusII-9.3d.lib
vtkexpat-9.3d.lib
vtkFiltersAMR-9.3d.lib
vtkFiltersCellGrid-9.3d.lib
vtkFiltersCore-9.3d.lib
vtkFiltersDSP-9.3d.lib
vtkFiltersExtraction-9.3d.lib
vtkFiltersFlowPaths-9.3d.lib
vtkFiltersGeneral-9.3d.lib
vtkFiltersGeneric-9.3d.lib
vtkFiltersGeometry-9.3d.lib
vtkFiltersGeometryPreview-9.3d.lib
vtkFiltersHybrid-9.3d.lib
vtkFiltersHyperTree-9.3d.lib
vtkFiltersImaging-9.3d.lib
vtkFiltersModeling-9.3d.lib
vtkFiltersParallel-9.3d.lib
vtkFiltersParallelImaging-9.3d.lib
vtkFiltersPoints-9.3d.lib
vtkFiltersProgrammable-9.3d.lib
vtkFiltersReduction-9.3d.lib
vtkFiltersSelection-9.3d.lib
vtkFiltersSMP-9.3d.lib
vtkFiltersSources-9.3d.lib
vtkFiltersStatistics-9.3d.lib
vtkFiltersTensor-9.3d.lib
vtkFiltersTexture-9.3d.lib
vtkFiltersTopology-9.3d.lib
vtkFiltersVerdict-9.3d.lib
vtkfmt-9.3d.lib
vtkfreetype-9.3d.lib
vtkGeovisCore-9.3d.lib
vtkgl2ps-9.3d.lib
vtkglew-9.3d.lib
vtkGUISupportQt-9.3d.lib
vtkGUISupportQtQuick-9.3d.lib
vtkGUISupportQtSQL-9.3d.lib
vtkhdf5-9.3d.lib
vtkhdf5_hl-9.3d.lib
vtkImagingColor-9.3d.lib
vtkImagingCore-9.3d.lib
vtkImagingFourier-9.3d.lib
vtkImagingGeneral-9.3d.lib
vtkImagingHybrid-9.3d.lib
vtkImagingMath-9.3d.lib
vtkImagingMorphological-9.3d.lib
vtkImagingSources-9.3d.lib
vtkImagingStatistics-9.3d.lib
vtkImagingStencil-9.3d.lib
vtkInfovisCore-9.3d.lib
vtkInfovisLayout-9.3d.lib
vtkInteractionImage-9.3d.lib
vtkInteractionStyle-9.3d.lib
vtkInteractionWidgets-9.3d.lib
vtkIOAMR-9.3d.lib
vtkIOAsynchronous-9.3d.lib
vtkIOCellGrid-9.3d.lib
vtkIOCesium3DTiles-9.3d.lib
vtkIOCGNSReader-9.3d.lib
vtkIOChemistry-9.3d.lib
vtkIOCityGML-9.3d.lib
vtkIOCONVERGECFD-9.3d.lib
vtkIOCore-9.3d.lib
vtkIOEnSight-9.3d.lib
vtkIOExodus-9.3d.lib
vtkIOExport-9.3d.lib
vtkIOExportGL2PS-9.3d.lib
vtkIOExportPDF-9.3d.lib
vtkIOFLUENTCFF-9.3d.lib
vtkIOGeometry-9.3d.lib
vtkIOHDF-9.3d.lib
vtkIOImage-9.3d.lib
vtkIOImport-9.3d.lib
vtkIOInfovis-9.3d.lib
vtkIOIOSS-9.3d.lib
vtkIOLegacy-9.3d.lib
vtkIOLSDyna-9.3d.lib
vtkIOMINC-9.3d.lib
vtkIOMotionFX-9.3d.lib
vtkIOMovie-9.3d.lib
vtkIONetCDF-9.3d.lib
vtkIOOggTheora-9.3d.lib
vtkIOParallel-9.3d.lib
vtkIOParallelXML-9.3d.lib
vtkIOPLY-9.3d.lib
vtkIOSegY-9.3d.lib
vtkIOSQL-9.3d.lib
vtkioss-9.3d.lib
vtkIOTecplotTable-9.3d.lib
vtkIOVeraOut-9.3d.lib
vtkIOVideo-9.3d.lib
vtkIOXML-9.3d.lib
vtkIOXMLParser-9.3d.lib
vtkjpeg-9.3d.lib
vtkjsoncpp-9.3d.lib
vtkkissfft-9.3d.lib
vtklibharu-9.3d.lib
vtklibproj-9.3d.lib
vtklibxml2-9.3d.lib
vtkloguru-9.3d.lib
vtklz4-9.3d.lib
vtklzma-9.3d.lib
vtkmetaio-9.3d.lib
vtknetcdf-9.3d.lib
vtkogg-9.3d.lib
vtkParallelCore-9.3d.lib
vtkParallelDIY-9.3d.lib
vtkpng-9.3d.lib
vtkpugixml-9.3d.lib
vtkRenderingAnnotation-9.3d.lib
vtkRenderingCellGrid-9.3d.lib
vtkRenderingContext2D-9.3d.lib
vtkRenderingContextOpenGL2-9.3d.lib
vtkRenderingCore-9.3d.lib
vtkRenderingFreeType-9.3d.lib
vtkRenderingGL2PSOpenGL2-9.3d.lib
vtkRenderingHyperTreeGrid-9.3d.lib
vtkRenderingImage-9.3d.lib
vtkRenderingLabel-9.3d.lib
vtkRenderingLICOpenGL2-9.3d.lib
vtkRenderingLOD-9.3d.lib
vtkRenderingOpenGL2-9.3d.lib
vtkRenderingQt-9.3d.lib
vtkRenderingSceneGraph-9.3d.lib
vtkRenderingUI-9.3d.lib
vtkRenderingVolume-9.3d.lib
vtkRenderingVolumeOpenGL2-9.3d.lib
vtkRenderingVtkJS-9.3d.lib
vtksqlite-9.3d.lib
vtksys-9.3d.lib
vtkTestingRendering-9.3d.lib
vtktheora-9.3d.lib
vtktiff-9.3d.lib
vtkverdict-9.3d.lib
vtkViewsContext2D-9.3d.lib
vtkViewsCore-9.3d.lib
vtkViewsInfovis-9.3d.lib
vtkViewsQt-9.3d.lib
vtkWrappingTools-9.3d.lib
vtkzlib-9.3d.lib
打开Vs,选择 调试-> 调试属性-> 链接器->输入->添加依赖项
将vtk-libs.txt中的内容粘贴
4.重启VS,重新打开项目
4.可能出现的问题
如果还会遇到其他问题,可能是
1、VS版本不兼容
2、Qt环境配置错误
可以看这个
3、本文参考
C++实践之Qt学习(扩展):Visual Studio中Qt开发环境的搭建_visual studio 与 qt-CSDN博客