vtk环境搭建(windowsXP/win7,vtk6.0.0+cmake2.8+vs2010)
?
1. 安裝vs2010(默認(rèn)方式)
2. 安裝cmake2.8(默認(rèn)方式)
3. 新建文件夾作為vtk文件根目錄(例如"E:\vtk6.0"),解壓vtk-6.0.0.zip到根目錄,將VTK6.0.0改名為vtk;解壓vtkdata-6.0.0.zip到根目錄,將VTKDATA6.0.0改名為vtkdata(名字可隨意,前后一致即可);新建bin文件夾
4. 打開cmake,若需選擇編譯器選vc2010即可,設(shè)置source code文件夾為E:/vtk6.0/vtk,設(shè)置build文件夾為E:/vtk6.0/bin,然后Configure,結(jié)束后為紅色,可根據(jù)自己需要修改選項,此處勾選BUILD_EXAMPLES(若為了速度可不選此項),CMAKE_INSTALL_PREFIX為默認(rèn)安裝路徑,此處默認(rèn)為C:/Program Files/VTK。修改后重新Configure,結(jié)束后可Generate。
至此在E:\vtk6.0\bin可看到VTK.sln,vc2010打開后編譯ALL_BUILD(比較慢),然后編譯INSTALL(需先設(shè)為啟動項目),然后編譯例子Cone,運行可看到旋轉(zhuǎn)的圓錐。
5. 新建空vc2010工程,添加cpp文件,拷入示例代碼(可從vtk.sln解決方案中拷某個示例代碼如cone),修改項目屬性:
配置屬性>>C/C++>>常規(guī)>>附加包含目錄 加入路徑C:\Program Files\VTK\include\vtk-6.0;
配置屬性>>鏈接器>>常規(guī)>>附加庫目錄 加入路徑C:\Program Files\VTK\lib;
配置屬性>>連接器>>常規(guī)>>輸入>>附加依賴項 改為:(可能不需要這么多,待高手提供更簡便的方法)
kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;vtkalglib-6.0.lib;vtkChartsCore-6.0.lib;vtkCommonColor-6.0.lib;vtkCommonDataModel-6.0.lib;vtkCommonMath-6.0.lib;vtkCommonCore-6.0.lib;vtksys-6.0.lib;vtkCommonMisc-6.0.lib;vtkCommonSystem-6.0.lib;vtkCommonTransforms-6.0.lib;vtkInfovisCore-6.0.lib;vtkFiltersExtraction-6.0.lib;vtkCommonExecutionModel-6.0.lib;vtkFiltersCore-6.0.lib;vtkFiltersGeneral-6.0.lib;vtkCommonComputationalGeometry-6.0.lib;vtkFiltersStatistics-6.0.lib;vtkImagingFourier-6.0.lib;vtkImagingCore-6.0.lib;vtkRenderingContext2D-6.0.lib;vtkRenderingCore-6.0.lib;vtkFiltersGeometry-6.0.lib;vtkFiltersSources-6.0.lib;vtkIOImage-6.0.lib;vtkDICOMParser-6.0.lib;vtkIOCore-6.0.lib;vtkzlib-6.0.lib;vtkmetaio-6.0.lib;vtkjpeg-6.0.lib;vtkpng-6.0.lib;vtktiff-6.0.lib;vtkIOXMLParser-6.0.lib;vtkexpat-6.0.lib;vtkRenderingFreeType-6.0.lib;vtkfreetype-6.0.lib;vtkftgl-6.0.lib;vtkRenderingOpenGL-6.0.lib;vtkImagingHybrid-6.0.lib;vtkDomainsChemistry-6.0.lib;vtkIOXML-6.0.lib;vtkIOGeometry-6.0.lib;vtkjsoncpp-6.0.lib;vtkexoIIc-6.0.lib;vtkNetCDF-6.0.lib;vtkNetCDF_cxx-6.0.lib;vtkhdf5_hl-6.0.lib;vtkhdf5-6.0.lib;vtkFiltersAMR-6.0.lib;vtkParallelCore-6.0.lib;vtkIOLegacy-6.0.lib;vtkFiltersFlowPaths-6.0.lib;vtkFiltersGeneric-6.0.lib;vtkFiltersHybrid-6.0.lib;vtkImagingSources-6.0.lib;vtkFiltersHyperTree-6.0.lib;vtkFiltersImaging-6.0.lib;vtkImagingGeneral-6.0.lib;vtkFiltersModeling-6.0.lib;vtkFiltersParallel-6.0.lib;vtkFiltersParallelImaging-6.0.lib;vtkFiltersProgrammable-6.0.lib;vtkFiltersSelection-6.0.lib;vtkFiltersTexture-6.0.lib;vtkFiltersVerdict-6.0.lib;vtkverdict-6.0.lib;vtkGeovisCore-6.0.lib;vtkInfovisLayout-6.0.lib;vtkInteractionStyle-6.0.lib;vtkInteractionWidgets-6.0.lib;vtkRenderingAnnotation-6.0.lib;vtkImagingColor-6.0.lib;vtkRenderingVolume-6.0.lib;vtkViewsCore-6.0.lib;vtkproj4-6.0.lib;vtkgl2ps-6.0.lib;vtkImagingMath-6.0.lib;vtkImagingMorphological-6.0.lib;vtkImagingStatistics-6.0.lib;vtkImagingStencil-6.0.lib;vtkInteractionImage-6.0.lib;vtkIOAMR-6.0.lib;vtkIOEnSight-6.0.lib;vtkIOExodus-6.0.lib;vtkIOExport-6.0.lib;vtkRenderingGL2PS-6.0.lib;vtkIOImport-6.0.lib;vtkIOInfovis-6.0.lib;vtklibxml2-6.0.lib;vtkIOLSDyna-6.0.lib;vtkIOMINC-6.0.lib;vtkIOMovie-6.0.lib;vtkoggtheora-6.0.lib;vtkIONetCDF-6.0.lib;vtkIOParallel-6.0.lib;vtkIOPLY-6.0.lib;vtkIOSQL-6.0.lib;vtksqlite-6.0.lib;vtkIOVideo-6.0.lib;vtkRenderingFreeTypeOpenGL-6.0.lib;vtkRenderingHybridOpenGL-6.0.lib;vtkRenderingImage-6.0.lib;vtkRenderingLabel-6.0.lib;vtkRenderingLOD-6.0.lib;vtkRenderingVolumeAMR-6.0.lib;vtkRenderingVolumeOpenGL-6.0.lib;vtkTestingGenericBridge-6.0.lib;vtkTestingIOSQL-6.0.lib;vtkTestingRendering-6.0.lib;vtkViewsContext2D-6.0.lib;vtkViewsGeovis-6.0.lib;vtkViewsInfovis-6.0.lib;vtkgl2ps-6.0.lib;vtkexoIIc-6.0.lib;vtkFiltersParallel-6.0.lib;vtkIONetCDF-6.0.lib;vtkNetCDF_cxx-6.0.lib;vtkNetCDF-6.0.lib;vtkhdf5_hl-6.0.lib;vtkhdf5-6.0.lib;vfw32.lib;vtkFiltersAMR-6.0.lib;vtkParallelCore-6.0.lib;vtkIOLegacy-6.0.lib;vtkIOSQL-6.0.lib;vtksqlite-6.0.lib;vtkGeovisCore-6.0.lib;vtkIOXML-6.0.lib;vtkIOGeometry-6.0.lib;vtkjsoncpp-6.0.lib;vtkproj4-6.0.lib;vtkRenderingContext2D-6.0.lib;vtkRenderingOpenGL-6.0.lib;glu32.lib;vtkFiltersImaging-6.0.lib;vtkInfovisLayout-6.0.lib;vtkInfovisCore-6.0.lib;vtkViewsCore-6.0.lib;vtkInteractionWidgets-6.0.lib;vtkImagingHybrid-6.0.lib;vtkFiltersHybrid-6.0.lib;vtkImagingGeneral-6.0.lib;vtkImagingSources-6.0.lib;vtkFiltersModeling-6.0.lib;vtkInteractionStyle-6.0.lib;vtkRenderingAnnotation-6.0.lib;vtkImagingColor-6.0.lib;vtkRenderingVolume-6.0.lib;vtkRenderingLabel-6.0.lib;vtkRenderingFreeType-6.0.lib;vtkRenderingCore-6.0.lib;vtkFiltersExtraction-6.0.lib;vtkFiltersStatistics-6.0.lib;vtkalglib-6.0.lib;vtkImagingFourier-6.0.lib;vtkImagingCore-6.0.lib;vtkFiltersGeometry-6.0.lib;vtkFiltersSources-6.0.lib;vtkFiltersGeneral-6.0.lib;vtkFiltersCore-6.0.lib;vtkCommonComputationalGeometry-6.0.lib;vtkIOImage-6.0.lib;vtkDICOMParser-6.0.lib;vtkmetaio-6.0.lib;comctl32.lib;wsock32.lib;vtkpng-6.0.lib;vtktiff-6.0.lib;vtkjpeg-6.0.lib;vtkIOXMLParser-6.0.lib;vtkIOCore-6.0.lib;vtkCommonExecutionModel-6.0.lib;vtkCommonDataModel-6.0.lib;vtkCommonMisc-6.0.lib;vtkCommonSystem-6.0.lib;vtkCommonTransforms-6.0.lib;vtkCommonMath-6.0.lib;vtkCommonCore-6.0.lib;vtksys-6.0.lib;ws2_32.lib;Psapi.lib;vtkexpat-6.0.lib;vtkftgl-6.0.lib;vtkfreetype-6.0.lib;vtkzlib-6.0.lib;opengl32.lib
?
至此編譯已經(jīng)沒有問題,運行會彈框報錯
Generic Warning: In ... ...\Rendering\Core\vtkPolyDataMapper.cxx, line 27
Error: no override found for 'vtkPolyDataMapper'
解決辦法是在cpp文件頭加上兩個宏定義(http://stackoverflow.com/questions/18642155/no-override-found-for-vtkpolydatamapper)
#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
#define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)
然后編譯,運行,旋轉(zhuǎn)圓錐出現(xiàn)了!!!
?
補充:
1.若cmake在gernerate是勾選GUI及MFC,ALL_BUILD編譯是可能會報錯,可參考
http://blog.csdn.net/left_la/article/details/7069708
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的vtk环境搭建(windowsXP/win7,vtk6.0.0+cmake2.8+vs2010)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MFC删除类的小窍门
- 下一篇: linux下md5sum的使用