安装是个很漫长的过程,cpu连续保持100%负荷运作10多分钟:
然后,好不容易把vtk的lib文件全部ok了,然后发现example中的vtkmfc例子不能正常运行,原始是缺失vtkmfc.lib文件,可是该文件并不存在,然后找到了以下这篇faq:
| Kitware Inc - Leaders in Visualization Technology | Search |
[vtkusers] Problem with finding vtkMFC.lib
Murat Ahat murat.ahat at gmail.com
Tue Aug 16 11:13:28 EDT 2005
- Previous message: [vtkusers] Problem with finding vtkMFC.lib
- Next message: [vtkusers] Where is vtkGLUTesselatorTriangleFilter?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 16 Aug 2005 14:57:44 +0200 __ukasz Tutaj <ltutaj at wp.pl> wrote: >
Hi vtk Users. > > I downloaded the latest updates from CVS repository, and tried to >
launch some GUI example. However I got error that there was no > vtkMFC.lib available.
After checking I found that there was no > vtkMFC.lib on my disk. I think it should be because
during building > VTK there was no error. Thanks for any help. > __ukasz Tutaj > I think you
have to build it with the GUI support. when you run cmake you have to run it with -i option.
for example: cmake -i and choose to use advanced options. thus you will see a GUI support
option, and you should set it ON. and also choose build with MFC support option. good luck!!!
- Previous message: [vtkusers] Problem with finding vtkMFC.lib
- Next message: [vtkusers] Where is vtkGLUTesselatorTriangleFilter?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the vtkusers mailing list
看完之后我狂晕,我再cmake时并没有设置任何选项,就完全按默认的选项来编辑的,看来vtk编译时默认是不会生成vtkmfc的lib文件的,看来还得重新编译一下:(
另外一篇安装vtk的文章:
Home > Tutorial > Install Libraries on Windows > VTK
Install VTK
If you don't have VTK download it here
Unzip VTK-4.2-LastestRelease.zip in $LibDir, this will create a new directory $LibDir/VTK otherwise rename it to VTK
Run CMake and select the $LibDir/VTK directory as 'Where is the source code'
Put the same path + "-VC++" (like Visual C++) as 'Where to build the binaries'
Be sure that 'Visual Studio 6' is selected.
Check 'Show Advanced Values'.

Click on Configure, CMake will ask you to create the VTK-VC++ folder

Put setup parameters exactly like that:
- BUILD_TESTING = OFF
- VTK_USE_ANSI_STDLIB = ON
- VTK_USE_HYBRID = ON
- VTK_USE_PATENDED = ON


Click twice again on 'Configure' and then click on 'OK'. This will generate a Visual C++ project (*.dsw) in $LibDir/VTK-VC++.
Launch $LibDir/VTK-VC++/VTK.dsw and compile in RelWithDebInfo mode.
To do that, right click on the menu and check 'Build', you can also uncheck 'Build MiniBar'.

Then select 'RelWithDebInfo'.
Start Compilation with ALL_BUILD
![]()
------------------------------------------------------------------------------
下面继续重新我的安装里程:
不管怎样,无论如何,vtk中自带的examples中的sampleMFC没能由编译好的lib文件链接运行,提示缺少vtkFiltering.dll文件等云云,貌似需要动态链接库,于是我查找了半天试修改该工程文件中哪里有引入动态链接库的地方,修改为静态的lib库,因为我好不容易才编译好了lib库文件,(p4 266Ghz的机子大概花费了12min编译完这些文件),最终失败!
不得以再次打开cmake再次修改make选项,重新又再次编译成dll动态链接库文件后才算成功了~~
晕死了,VTK的安装!!
然后仿照那个例子,自己建了一个sdi的mfc程序如下:

------------------------------------------------------------------
另外一个vtk窗口程序,以作为留念:

上图代码下载
-------------------------------------------------------------------------
至此,基本上搞定了VTK的安装,但是如何使用编译好的静态链接库文件书写程序,还有待进一步考究~!
------------------------------------------------
下面是自己书写的一个最最简单的cone程序:
#include "stdafx.h"
#include "vtkconesource.h"
#include "vtkpolydatamapper.h"
#include "vtkactor.h"
#include "vtkrenderer.h"
#include "vtkrenderwindow.h"
int main(int argc, char* argv[])
{
vtkConeSource *cone=vtkConeSource::New();
cone->SetHeight(5);
cone->SetRadius(2);
cone->SetResolution(100);
vtkPolyDataMapper * map=vtkPolyDataMapper::New();
map->SetInput(cone->GetOutput());
vtkActor *actor=vtkActor::New();
actor->SetMapper(map);
vtkRenderer * ren=vtkRenderer::New();
ren->AddActor(actor);
ren->SetBackground(.9,.5,.4);
vtkRenderWindow* win=vtkRenderWindow::New();
win->AddRenderer(ren);
win->SetSize(600,480);
while (1)
win->Render();
return 0;
}
/*
libs includes:vtkRendering.lib vtkGraphics.lib vtkImaging.lib vtkIO.lib vtkFiltering.lib vtkCommon.lib vtksys.lib vtkDICOMParser.lib vtkpng.lib vtktiff.lib vtkzlib.lib vtkjpeg.lib vtkexpat.lib vfw32.lib vtkMPEG2Encode.lib vtkftgl.lib vtkfreetype.lib opengl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
*/