0 Compiling Environment
0.1 Package and version
Qt5.9.4 |
msvc2015_64 |
VS2015 | td> tr> |
VTK 8.1.1 |
https://www.vtk.org/download/ |
cmake3.11.3 |
|
0.2 Local directory description
Qt5.9.4 msvc64 directory |
C: \ Qt \ Qt5.9.4\5.9.4 \ msvc2015_64 |
VTK decompression directory |
C: \ WS \ VTK \ VTK – 8.1.1 |
VTK Build directory |
C: \ WS, VTK, VTK – 8.1.1, build |
VTK installation directory (containing compiled inc,lib) |
C:\vtk |
1 the VTK download
1.1 Download VTK-8.1.1.zip,VTKData-8.1.1.zip files
1.2 unzip
Select unzip to the current directory, the two files will be automatically assembled in the vtk-8.1.1 folder after unzip.
2. Configure VTK for Qt
2.1 Start CMake, specify the source directory and compile directory, and click Configure.
2.2 Specify the VS version
64-bit Visual Studio 14 2015 Win64, 32-bit Visual Studio 14 2015. Click Finish and wait for the configuration to complete.
2.3 Configure compilation options (1)
BUILD options
Select Build_Examples, Build_Shared_Libs, and Build_Testing.
Note:
It is not recommended to select Documentation, which requires that Doxygen be installed first.
It is not recommended to remove TESTING as this will cause errors to be reported at the later VS compilation stage and header files to be modified.
VTK installation directory
Include, lib, DLL (bin), and so on.
VTK_Group_Qt
Set the target environment for compilation to Qt.
Once you have done all three Settings, click Configure.
2.4 Configure compilation options (2)
After the first configuration is complete, the user is prompted for Qt5_DIR and VKT_QT_VERSION.
Amend the Qt5_DIR to C:/Qt/Qt5.9.4 5.9.4 msvc2015_64/lib/cmake/Qt5.
Set VKT_QT_VERSION to 5.
Click Configure again to continue.
2.5 the Generate engineering
When the configuration is successful, a Configure Done prompt appears. Click Generate to build the project.
2.6 Start VS2015 and start compiling
Generating done indicates that VS2015 project has been generated successfully. Click Open Project, VS2015 will start and Open the Project.
3 Compile VTK project in VS2015
3.1 build
After opening the project, the default startup item is ALL_BUILD, and you can directly select Build. Both the Release and Debug versions need to be built, so two compilations are performed.
It’s been a long time, long time… . And it worked.
3.2 installation
Select Install, right-click Build.
Install OK.
3.3 Compiling results
The results of VS2015 compilation include four parts.
1. Include does not distinguish between Release and Debug versions
2. Lib does not discriminate versions
3. The DLL selects debug and release versions according to the input configuration.
4. Plugin DLL is only available in Release versions.
The four compiled results are placed in two locations.
The.h and.lib files are stored in the C:\VTK directory (step 2.3 configuration). Please do not use DLL files under C:\VTK, because there is no distinction between release and debug.
The.dll file is placed in C:\WS\ VTK \ vtk-8.1.1 \build\bin (step 2.1 configuration).
3.4 Compile test successfully (you can skip this step if you don’t want to test)
Compiled DLLs and EXEs in vtk-8.1.1\ build\bin\Release\
Copy qt5gui.dll, qt5core. DLL, qt5Widgets. DLL from the Qt directory to this directory or the debug directory. (Environment variables can also be configured)
Run qtvtkrenderWindows.exe in this directory, and see as shown in the figure, the compilation of exe is successful after startup.
4. Install the QVTKWidget plug-in for Qt Designer
4.1 installation
Will be C: \ WS, VTK, VTK – 8.1.1, build \ bin \ Release \
Copy the QVTKWidgetPlugin.dll to the C:\Qt\Qt5.9.4\5.9.4\msvc2015_64\plugins\designer\ directory.
Note: Be sure to copy the Release version.
4.2 validation
Start Qt Designer.
There are two versions, usually 32-bit at the top and 64-bit at the bottom. Select according to the compiled version.
At the bottom of the left-hand Widget Box you can see the QVTKWidget description installed successfully.
5 supplementary
5.1 Use VTK in VS2015 environment
You need to install the Qt Visual Studio Tools extension in the VS2015 extension and update. Note that QTPackage cannot use the QVTKWidget, do not install.
Installation steps
1. Select Extend and Update from the Tools menu
2. Select Qt Visual Studio Tools for installation online. There is also a QTPackage that cannot be used, do not install it.
3. After successful installation, Qt VS Tools will appear on the menu. Click Launch Qt Designer to see it.
5.2 Use VTK in the Qt Creator environment
Designer in Qt Creator environment cannot see QVTKWidget, so it cannot be dragged and dropped directly. You need to drag and drop QWidget first, and then select QWidget to be promoted to QvtkWidget.
Read More:
- VTK + QT + vs compilation and installation configuration
- Vtk8.2.0 (32bit + 64bit) compilation and installation test (win10 + vs2017 + Qt5)
- Vtk8.0 compilation process record under vs2017 and qt5.12.1
- [VTK] vtk8.2.0 + vs2015 + win10 compilation and configuration
- Vs2017 compiles pcl1.8.1 with vtk8.0 and uses qt5.9.5
- QT encountered in CentOS installation( qt.qpa.plugin : Could not load the Qt platform plugin “xcb” )
- Solutions to several VTK compilation errors (vtk5.8 + VS2010)
- Some errors in VTK compilation
- QT learning 3: configuration and testing of QT creator 2.4.1 development environment
- Problems encountered in VTK installation
- Compilation errors and warnings encountered in QT and their solutions
- Common mistakes and solutions of cmake + QT + VTK
- VTK series: installation and introduction of VTK
- Problems in compiling VTK with cmake: solutions to error configuration process, project files may be invalid
- Recording some pits of VTK + QT
- Qt5 when compiling VTK_ The solution of dir-notfound
- To solve problems in cmake VTK: error configuration process, project files may be invalid
- VTK installation
- Configuration and use of qt5.9.6 and vs2015
- Error in configuration process, project files may be invalid in cmake compilation