windows和linux下VTK7.0.0的配置
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
免费下载资源
·
开发环境
Windows 7
VS2013
Ubuntu14.04
VTK7.0.0
cmake
windows
cmake安装
- 在官网下载,直接安装即可,尽量使用新版本。
VTK下载及解压
- 从官网下载
VTK-7.0.0.zip
和VTKData-7.0.0.zip
,解压到自己新建的一个文件夹中,我的就是它解压出来的文件夹VTK-7.0.0
,绝对路径是E:\InstallFolders\VTK
- 在刚才的文件夹的同级文件夹中新建
VTK-7.0.0-bin
文件夹,用于之后解压cmake的目标目录。
* 打开cmake,选择编译的原目录和目标目录,如下:
点击cmake左下方的
Configure
按钮,选择Visual Studio 12 2013
,无论是什么VS的版本,尽量不要选Win64
版本(我没试过=。=)。勾选上方的
Advanced
复选框,点击Config
开始编译。- 如果出现错误(有红色标出),重新Config,直到没有错误为止。在这一步中,有一些选项可以选择,如
BUILD_EXAMPLES
、BUILD_SHARED_LIBS
等,刚才提到的是比较重要的,按照下图配置
其他的按照默认即可,下图是没有错误生成时的情形。
- 点击
Configure
右边的Generate
,完成即可。
VS测试是否编译成功
- 在编译输出目录下有一个VTK.sln的文件,直接打开,全部重新编译,如果没有错误,则说明安装成功,选择
Cone6
的项目,启动新实例,得到以下图像
VS配置
- 在VS中新建一个空的的
ConsoleApplication
,添加main.cpp,将刚才的Cone6中的Cone6.cxx
中的内容拷贝过去,此时编译会报错。接下来进行配置。 - 打开
property manager->Microsoft.Cpp.Win32.user
的属性,在VC++ Directories
中的Library Directories
里添加E:\InstallFolders\VTK\VTK-7.0.0-bin\lib\Debug
,即库目录。 - 在
C/C++ -> General
中的Additional Include Directories
中添加E:\InstallFolders\VTK\VTK-7.0.0-bin\Filters\Sources;E:\InstallFolders\VTK\VTK-7.0.0\Filters\Sources;E:\InstallFolders\VTK\VTK-7.0.0-bin\Common\ComputationalGeometry;E:\InstallFolders\VTK\VTK-7.0.0\Common\ComputationalGeometry;E:\InstallFolders\VTK\VTK-7.0.0-bin\Common\DataModel;E:\InstallFolders\VTK\VTK-7.0.0\Common\DataModel;E:\InstallFolders\VTK\VTK-7.0.0-bin\Common\Math;E:\InstallFolders\VTK\VTK-7.0.0\Common\Math;E:\InstallFolders\VTK\VTK-7.0.0-bin\Common\Core;E:\InstallFolders\VTK\VTK-7.0.0\Common\Core;E:\InstallFolders\VTK\VTK-7.0.0-bin\Utilities\KWSys;E:\InstallFolders\VTK\VTK-7.0.0\Utilities\KWSys;E:\InstallFolders\VTK\VTK-7.0.0-bin\Common\Misc;E:\InstallFolders\VTK\VTK-7.0.0\Common\Misc;E:\InstallFolders\VTK\VTK-7.0.0-bin\Common\System;E:\InstallFolders\VTK\VTK-7.0.0\Common\System;E:\InstallFolders\VTK\VTK-7.0.0-bin\Common\Transforms;E:\InstallFolders\VTK\VTK-7.0.0\Common\Transforms;E:\InstallFolders\VTK\VTK-7.0.0-bin\Filters\General;E:\InstallFolders\VTK\VTK-7.0.0\Filters\General;E:\InstallFolders\VTK\VTK-7.0.0-bin\Filters\Core;E:\InstallFolders\VTK\VTK-7.0.0\Filters\Core;E:\InstallFolders\VTK\VTK-7.0.0-bin\Common\ExecutionModel;E:\InstallFolders\VTK\VTK-7.0.0\Common\ExecutionModel;E:\InstallFolders\VTK\VTK-7.0.0-bin\Interaction\Widgets;E:\InstallFolders\VTK\VTK-7.0.0\Interaction\Widgets;E:\InstallFolders\VTK\VTK-7.0.0-bin\Filters\Hybrid;E:\InstallFolders\VTK\VTK-7.0.0\Filters\Hybrid;E:\InstallFolders\VTK\VTK-7.0.0-bin\Imaging\Sources;E:\InstallFolders\VTK\VTK-7.0.0\Imaging\Sources;E:\InstallFolders\VTK\VTK-7.0.0-bin\Imaging\Core;E:\InstallFolders\VTK\VTK-7.0.0\Imaging\Core;E:\InstallFolders\VTK\VTK-7.0.0-bin\Rendering\Core;E:\InstallFolders\VTK\VTK-7.0.0\Rendering\Core;E:\InstallFolders\VTK\VTK-7.0.0-bin\Common\Color;E:\InstallFolders\VTK\VTK-7.0.0\Common\Color;E:\InstallFolders\VTK\VTK-7.0.0-bin\Filters\Extraction;E:\InstallFolders\VTK\VTK-7.0.0\Filters\Extraction;E:\InstallFolders\VTK\VTK-7.0.0-bin\Filters\Statistics;E:\InstallFolders\VTK\VTK-7.0.0\Filters\Statistics;E:\InstallFolders\VTK\VTK-7.0.0-bin\Imaging\Fourier;E:\InstallFolders\VTK\VTK-7.0.0\Imaging\Fourier;E:\InstallFolders\VTK\VTK-7.0.0-bin\ThirdParty\alglib;E:\InstallFolders\VTK\VTK-7.0.0\ThirdParty\alglib;E:\InstallFolders\VTK\VTK-7.0.0-bin\Filters\Geometry;E:\InstallFolders\VTK\VTK-7.0.0\Filters\Geometry;E:\InstallFolders\VTK\VTK-7.0.0-bin\Filters\Modeling;E:\InstallFolders\VTK\VTK-7.0.0\Filters\Modeling;E:\InstallFolders\VTK\VTK-7.0.0-bin\Imaging\General;E:\InstallFolders\VTK\VTK-7.0.0\Imaging\General;E:\InstallFolders\VTK\VTK-7.0.0-bin\Imaging\Hybrid;E:\InstallFolders\VTK\VTK-7.0.0\Imaging\Hybrid;E:\InstallFolders\VTK\VTK-7.0.0-bin\IO\Image;E:\InstallFolders\VTK\VTK-7.0.0\IO\Image;E:\InstallFolders\VTK\VTK-7.0.0-bin\Utilities\DICOMParser;E:\InstallFolders\VTK\VTK-7.0.0\Utilities\DICOMParser;E:\InstallFolders\VTK\VTK-7.0.0-bin\IO\Core;E:\InstallFolders\VTK\VTK-7.0.0\IO\Core;E:\InstallFolders\VTK\VTK-7.0.0-bin\ThirdParty\zlib;E:\InstallFolders\VTK\VTK-7.0.0\ThirdParty\zlib;E:\InstallFolders\VTK\VTK-7.0.0-bin\Utilities\MetaIO\vtkmetaio;E:\InstallFolders\VTK\VTK-7.0.0-bin\Utilities\MetaIO;E:\InstallFolders\VTK\VTK-7.0.0\Utilities\MetaIO;E:\InstallFolders\VTK\VTK-7.0.0-bin\ThirdParty\jpeg;E:\InstallFolders\VTK\VTK-7.0.0\ThirdParty\jpeg;E:\InstallFolders\VTK\VTK-7.0.0-bin\ThirdParty\png;E:\InstallFolders\VTK\VTK-7.0.0\ThirdParty\png;E:\InstallFolders\VTK\VTK-7.0.0-bin\ThirdParty\tiff;E:\InstallFolders\VTK\VTK-7.0.0\ThirdParty\tiff;E:\InstallFolders\VTK\VTK-7.0.0-bin\Interaction\Style;E:\InstallFolders\VTK\VTK-7.0.0\Interaction\Style;E:\InstallFolders\VTK\VTK-7.0.0-bin\Rendering\Annotation;E:\InstallFolders\VTK\VTK-7.0.0\Rendering\Annotation;E:\InstallFolders\VTK\VTK-7.0.0-bin\Imaging\Color;E:\InstallFolders\VTK\VTK-7.0.0\Imaging\Color;E:\InstallFolders\VTK\VTK-7.0.0-bin\Rendering\FreeType;E:\InstallFolders\VTK\VTK-7.0.0\Rendering\FreeType;E:\InstallFolders\VTK\VTK-7.0.0-bin\ThirdParty\freetype;E:\InstallFolders\VTK\VTK-7.0.0\ThirdParty\freetype;E:\InstallFolders\VTK\VTK-7.0.0-bin\Rendering\Volume;E:\InstallFolders\VTK\VTK-7.0.0\Rendering\Volume;E:\InstallFolders\VTK\VTK-7.0.0-bin\Rendering\OpenGL2;E:\InstallFolders\VTK\VTK-7.0.0\Rendering\OpenGL2;E:\InstallFolders\VTK\VTK-7.0.0-bin\Utilities\EncodeString;E:\InstallFolders\VTK\VTK-7.0.0\Utilities\EncodeString;E:\InstallFolders\VTK\VTK-7.0.0-bin\ThirdParty\glew;E:\InstallFolders\VTK\VTK-7.0.0\ThirdParty\glew;E:\InstallFolders\VTK\VTK-7.0.0-bin\bin\Debug;%(AdditionalIncludeDirectories)
。 在
Linker -> Input -> Additional Dependencies
中添加kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib comctl32.lib vfw32.lib ws2_32.lib wsock32.lib opengl32.lib vtkChartsCore-7.0.lib vtkCommonColor-7.0.lib vtkCommonComputationalGeometry-7.0.lib vtkCommonCore-7.0.lib vtkCommonDataModel-7.0.lib vtkCommonExecutionModel-7.0.lib vtkCommonMath-7.0.lib vtkCommonMisc-7.0.lib vtkCommonSystem-7.0.lib vtkCommonTransforms-7.0.lib vtkDICOMParser-7.0.lib vtkDomainsChemistry-7.0.lib vtkDomainsChemistryOpenGL2-7.0.lib vtkFiltersAMR-7.0.lib vtkFiltersCore-7.0.lib vtkFiltersExtraction-7.0.lib vtkFiltersFlowPaths-7.0.lib vtkFiltersGeneral-7.0.lib vtkFiltersGeneric-7.0.lib vtkFiltersGeometry-7.0.lib vtkFiltersHybrid-7.0.lib vtkFiltersHyperTree-7.0.lib vtkFiltersImaging-7.0.lib vtkFiltersModeling-7.0.lib vtkFiltersParallel-7.0.lib vtkFiltersParallelImaging-7.0.lib vtkFiltersProgrammable-7.0.lib vtkFiltersSMP-7.0.lib vtkFiltersSelection-7.0.lib vtkFiltersSources-7.0.lib vtkFiltersStatistics-7.0.lib vtkFiltersTexture-7.0.lib vtkFiltersVerdict-7.0.lib vtkGeovisCore-7.0.lib vtkIOAMR-7.0.lib vtkIOCore-7.0.lib vtkIOEnSight-7.0.lib vtkIOExodus-7.0.lib vtkIOExport-7.0.lib vtkIOGeometry-7.0.lib vtkIOImage-7.0.lib vtkIOImport-7.0.lib vtkIOInfovis-7.0.lib vtkIOLSDyna-7.0.lib vtkIOLegacy-7.0.lib vtkIOMINC-7.0.lib vtkIOMovie-7.0.lib vtkIONetCDF-7.0.lib vtkIOPLY-7.0.lib vtkIOParallel-7.0.lib vtkIOParallelXML-7.0.lib vtkIOSQL-7.0.lib vtkIOVideo-7.0.lib vtkIOXML-7.0.lib vtkIOXMLParser-7.0.lib vtkImagingColor-7.0.lib vtkImagingCore-7.0.lib vtkImagingFourier-7.0.lib vtkImagingGeneral-7.0.lib vtkImagingHybrid-7.0.lib vtkImagingMath-7.0.lib vtkImagingMorphological-7.0.lib vtkImagingSources-7.0.lib vtkImagingStatistics-7.0.lib vtkImagingStencil-7.0.lib vtkInfovisCore-7.0.lib vtkInfovisLayout-7.0.lib vtkInteractionImage-7.0.lib vtkInteractionStyle-7.0.lib vtkInteractionWidgets-7.0.lib vtkLocalExample-7.0.lib vtkNetCDF-7.0.lib vtkNetCDF_cxx-7.0.lib vtkParallelCore-7.0.lib vtkRenderingAnnotation-7.0.lib vtkRenderingContext2D-7.0.lib vtkRenderingContextOpenGL2-7.0.lib vtkRenderingCore-7.0.lib vtkRenderingFreeType-7.0.lib vtkRenderingImage-7.0.lib vtkRenderingLOD-7.0.lib vtkRenderingLabel-7.0.lib vtkRenderingOpenGL2-7.0.lib vtkRenderingVolume-7.0.lib vtkRenderingVolumeOpenGL2-7.0.lib vtkViewsContext2D-7.0.lib vtkViewsCore-7.0.lib vtkViewsInfovis-7.0.lib vtkalglib-7.0.lib vtkexoIIc-7.0.lib vtkexpat-7.0.lib vtkfreetype-7.0.lib vtkglew-7.0.lib vtkhdf5-7.0.lib vtkhdf5_hl-7.0.lib vtkjpeg-7.0.lib vtkjsoncpp-7.0.lib vtklibxml2-7.0.lib vtkmetaio-7.0.lib vtkmyCommon.lib vtkmyImaging.lib vtkmyUnsorted.lib vtkoggtheora-7.0.lib vtkpng-7.0.lib vtkproj4-7.0.lib vtksqlite-7.0.lib vtksys-7.0.lib vtktiff-7.0.lib vtkverdict-7.0.lib vtkzlib-7.0.lib
- 上面在属性管理器中配置好了,之后再新建项目的时候不用重新配置了
项目本身的配置
- 如果此时运行,会提示
no override found for 'vtkPolyDataMapper'
。因为VTK使用cmake编译的,在VS下编译的话则需要预编译的一些宏定义。 - 点击新建的项目的属性,在
C/C++ -> Preprocessor
中添加WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;VTK_IN_VTK;vtkRenderingCore_INCLUDE="E:/InstallFolders/VTK/VTK-7.0.0-bin/CMakeFiles/vtkRenderingCore_AUTOINIT_vtkInteractionStyle_vtkRenderingFreeType_vtkRenderingOpenGL2.h";CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)
,注意不要将之前项目中的宏定义覆盖了。具体的预编译的部分可以参考Cone6
中的预编译的宏定义。 - 在之后每次新建工程时,都需要添加预编译的宏定义!
结果
- 运行程序,得到和之前相同的图片如下:
一些有用的链接
http://blog.csdn.net/left_la/article/details/7069708
http://stackoverflow.com/questions/18642155/no-override-found-for-vtkpolydatamapper
注意
- 可以将预编译的宏定义放到
property manager
中,不用之后每次新建项目都定义,但是有一点需要注意:里面的vtkRenderingCore_INCLUDE="E:/InstallFolders/VTK/VTK-7.0.0-bin/CMakeFiles/vtkRenderingCore_AUTOINIT_vtkInteractionStyle_vtkRenderingFreeType_vtkRenderingOpenGL2.h"
是在对应的位置上,不同的项目要求的makeFile的头文件可能不一样(对应的文件夹下共有4个头文件),如果报野指针异常的错误,可以考虑是否是这个头文件的问题。
linux
g++ cmake等基本软件需要安装
- 剩下的直接按照这个教程来就行。ccmake运行时会提示要install哪个安装包,按照提示来就行,教程链接在这:http://www.linuxdiyf.com/linux/21391.html
- 在ccmake时,可能会提示没有opengl相关的宏,按照这篇文章http://blog.csdn.net/acidgl8757/article/details/9383915安装opengl相关库即可。
- ccmake之后,不报错时,还需要cmake ../,然后make, sudo make install。
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
已为社区贡献4条内容
所有评论(0)