[vtkusers] Difficulties migrating from vtk5.10.1 to vtk6.1.0 (MSVC++)

pof jd379252 at gmail.com
Tue Apr 8 14:45:56 EDT 2014


Le 08/04/2014 19:46, Marcus D. Hanwell a écrit :
> On Sun, Apr 6, 2014 at 2:48 PM, pof <jd379252 at gmail.com> wrote:
>> Hi all,
>>
>> I am (desperately)  trying to migrate my application from 5.10.1 to 6.1.0,
>> and so far without any success.
>> I guess the problem comes from the fact that my application is compiled and
>> linked with MSVisualStudio, without any use of CMake (though I obviously use
>> CMake used to compile vtk librairies).
>>
>> Typically, I tried to follow what is mentionned on the wiki, i.e. adding the
>> following 2 lines at the beginning of header files that #include vtk
>> objects:
>> #define vtkRenderingCore_AUTOINIT
>> 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
>> #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)
> I would advise you to use the new macros I added as they just need to
> be called one from your application (not defined before any header is
> included). See,
>
> http://www.vtk.org/Wiki/VTK/Build_System_Migration#How_Implementation_Modules_Are_Initialized
>
> #include <vtkAutoInit.h>
>
>   VTK_MODULE_INIT(vtkRenderingOpenGL);
>   VTK_MODULE_INIT(vtkInteractionStyle);
>
> That would initialize the vtkRenderingOpenGL and vtkInteractionStyle
> modules and you would not need to add compiler definitions on the
> command line or by hand.
>> But this does not work. I also try to add paths for include files, without
>> success. For instance, compiling a simple file, the compiler complains with:
>> fatal error C1083: Impossible to open include file :
>> 'vtkRenderWindowInteractor.h : No such file or directory
> If you build against an installed VTK then all of the includes will be
> installed to one directory, and then you just need to ensure you add
> that to the include search path. If you choose to build against the
> build tree then you must add every source and binary directory for
> every module you use and/or depend up on.
>> So I'm completely lost. Is there any available example (using MSVC++) of a
>> simple project successfuly migrated in vtk6.
>>
> I am not sure of any examples, but the above should make this pretty
> simple. Hopefully this helps.
>
> Marcus
Hi Markus,

I added your macro in the main header file:
     //VTK - auto initialization
     #include <vtkAutoInit.h>
     VTK_MODULE_INIT(vtkRenderingOpenGL);
     VTK_MODULE_INIT(vtkInteractionStyle);
     VTK_MODULE_INIT(vtkRenderingFreeType);
and I removed the following 2 lines from all the files I initially added 
it to:
     //#define vtkRenderingCore_AUTOINIT 
4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
     //#define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)

Setting the correct install path (thanks to Artur & John, I now have the 
"VTK\include\vtk-6.1" directory), all sources files now compile.
So I did some progress.

However, I'm no there yet as it does not link.
It looks like quite some libs have changed name, and I'm not sure which 
of the new ones I should add in the dependency.
Is there a clever way to define which ones I need, or do I need to use a 
trial/error procedure?

Thanks for helping
Pof



More information about the vtkusers mailing list