[vtkusers] VTK 6.0 with Visual Studio

Joseph Melnyk JMelnyk at pile.com
Wed Jul 24 13:21:47 EDT 2013


Brooke
Thanks for the clarification.  I didn't know that the *Module.h files were referenced when building a VTK project with CMake, so that makes sense to include them.  I've changed the directories I'm including to be those used from the CMake build directory - which include the *Module.h files - and have the same results.  Interestingly, my install/include/vtk-6.0 folder also includes several *Module.h files, and after diffing a few of them against their CMake build directory counterparts, they seem to be the same.  So it seems that, at least in my case, inclusion of the CMake build directories is superfluous and the problem likely lies elsewhere.

Thanks again
Joseph





From: Brooke Steele [mailto:bnsteel at gmail.com]
Sent: Wednesday, July 24, 2013 12:00 PM
To: Joseph Melnyk
Subject: Re: [vtkusers] VTK 6.0 with Visual Studio

Joseph,

Yes, I used VTK 5.10 the same way as you.

When I said build directory, I meant the directory I entered into CMake at the top "Where to build the binaries", not the directory created by the VS build..

I used "vtk6.0build", so I would include   "F:\wasatch\VTK6.0.0\Common\Math"  and "F:\wasatch\vtkbuild6.0.0\Common\Math"  In the" vtkbuild6.0.0\Common\Math" directory, there is only one header file, vtkCommonMathModule.h,  It's the *Module.h files that would be missing from the install directories and the lack of which that causes the class to fail to be instantiated.

You might could just add all of the module (build directory) header files to the install include directory.   I didn't try that.  I just tried to emulated the way CMake set up a VSproject to use VTK so that when I modify/update and recompile VTK, my project would just work.

On Wed, Jul 24, 2013 at 11:34 AM, Joseph Melnyk <JMelnyk at pile.com<mailto:JMelnyk at pile.com>> wrote:
Thanks for the suggestion Brooke.  It's encouraging to know that someone got it working!

Unfortunately, I attempted your suggestion and I'm still having the same problems.  But it is entirely possible that I've done something incorrectly.  Previously - as in up to VTK5.10 - all I did for my "Additional Include Directories" in VS was add the installed include directory for the built version of VTK.  That is, when building VTK via CMake and then VS, I set an install directory and then after running the "ALL_BUILD" project in VS, I run the "INSTALL" project as well.  This is what I mean by "installed include directory."  It's this directory that I point VS to from my project to grab my VTK headers.  What you're suggesting, if I understand you correctly, is to also add sub-directories from the directory that CMake is building from.  So for example if my install directory is called "VTK6.0.0_install" and I'm building from "VTK6.0.0", then in addition to including directory "VTK6.0.0_install\include" in my project I also need to include directory "VTK6.0.0\Charts\Core", "VTK6.0.0\Common\Core", etc...  Correct?  Because that's what I've done so far.  The reason why I believe this might not be what you meant is that I've run a diff on a random selection of files from these two directories and have seen no difference between them.  However, these are the only two sets of headers that I believe you could be referring to; so, I'm confused...

Thanks again for the help.
Joseph




From: Brooke Steele [mailto:bnsteel at gmail.com<mailto:bnsteel at gmail.com>]
Sent: Tuesday, July 23, 2013 3:34 PM
To: Joseph Melnyk
Cc: Bill Lorensen; vtkusers at vtk.org<mailto:vtkusers at vtk.org>

Subject: Re: [vtkusers] VTK 6.0 with Visual Studio

Joseph,

I recently was successful in getting VTK6.0 working with my VS2008 project.

What I had to do was include the headers in BOTH the source distribution AND the CMake build directory. It would build fine with just the source headers, since that is where the definitions are, but it wouldn't run because the macro/module definitions are in the build directory.

 There are 50 vtk include directories in my project, half from the source and half from the build.

Brooke

On Tue, Jul 23, 2013 at 1:55 PM, Joseph Melnyk <JMelnyk at pile.com<mailto:JMelnyk at pile.com>> wrote:
I built VTK in debug mode and got a bit more information.  The debugger doesn't trace into VTK, it just outputs the following to the output console:
        Generic Warning: In ..\..\..\VTK6.0.0\Rendering\Core\vtkRenderer.cxx, line 47
        Error: no override found for 'vtkRenderer'.
        Generic Warning: In ..\..\..\VTK6.0.0\Rendering\Core\vtkRenderWindow.cxx, line 35
        Error: no override found for 'vtkRenderWindow'

Which are the respective lines:
        vtkAbstractObjectFactoryNewMacro(vtkRenderer)
        vtkAbstractObjectFactoryNewMacro(vtkRenderWindow)

This occurs when I try to execute the following line:
        vtkSmartPointer<vtkContextView> view = vtkSmartPointer<vtkContextView>::New();

Note that I am doing the autoinit as follows:
        #define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
        #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)

This is defined within the header file of any class using VTK.






From: Bill Lorensen [mailto:bill.lorensen at gmail.com<mailto:bill.lorensen at gmail.com>]
Sent: Tuesday, July 23, 2013 11:35 AM
To: Joseph Melnyk
Cc: Robert Maynard; vtkusers at vtk.org<mailto:vtkusers at vtk.org>
Subject: Re: [vtkusers] VTK 6.0 with Visual Studio

If you build your VTK Debug you you should see more.

On Tue, Jul 23, 2013 at 11:24 AM, Joseph Melnyk <JMelnyk at pile.com<mailto:JMelnyk at pile.com>> wrote:
Thanks for the suggestion.  I can't trace directly into the vtk dll's for more information.  The stack trace just tells me where they've failed in the .h file, which is just the New() call.

As I said, some objects will instantiate and can be used just fine.  For example, I can use vtkTable and vtkFloatArray just fine but then when I try to use vtkContextView or vtkInteractorStyleTrackballCamera, the New() event fails.

Regards
Joseph Melnyk



> -----Original Message-----
> From: Robert Maynard [mailto:robert.maynard at kitware.com<mailto:robert.maynard at kitware.com>]
> Sent: Tuesday, July 23, 2013 9:14 AM
> To: Joseph Melnyk
> Cc: vtkusers at vtk.org<mailto:vtkusers at vtk.org>
> Subject: Re: [vtkusers] VTK 6.0 with Visual Studio
>
> Are you able to provide more information on the exact violation exceptions
> with a back trace? Access violations can occur when you call methods on a
> NULL object, so it could be a case that a object factory that is NULL is being
> asked to create classes.
>
> On Mon, Jul 22, 2013 at 2:45 PM, Joseph Melnyk <JMelnyk at pile.com<mailto:JMelnyk at pile.com>> wrote:
> > I'm attempting to port an existing code base from VTK 5.10 to 6.0.  This
> code base has existed and worked happily with VTK 5.x for a few years now,
> being built with Visual Studio 2008.  When I began the port to 6.0, I followed
> the migration guide found here:
> http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide and the code builds
> and links just fine.  However, when I run it, I'm getting access violation
> exceptions (attempts to read/write protected memory) when I try
> instantiating with New().  Researching further, I see that this problem is
> mentioned here:
> http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Factories_now_require_de
> fines  HOWEVER I'm not getting NULL objects with the New() call, I'm getting
> exceptions.  Furthermore, it doesn't happen with every VTK object; some
> instantiate and can be used just fine.  Nonetheless, I tried the suggestions at
> the second link, regarding definition of VTK AUTOINIT, and they proved
> fruitless.  So I'm currently at a loss...
> >
> > For what it's worth, I'm building VTK with CMAKE and the only options I'm
> changing from the default configuration are the following:
> > - build shared libs
> > - don't build TESTING
> > - set custom install directory
> >
> > Thanks for your time; any help would be greatly appreciated...
> > Joseph Melnyk
> >
> > __Scanned by MessageLabs
> > _______________________________________________
> > Powered by www.kitware.com<http://www.kitware.com>
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
>
> _Scanned by MessageLabs

__Scanned by MessageLabs
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers



--
Unpaid intern in BillsBasement at noware dot com

_Scanned by MessageLabs

__Scanned by MessageLabs
_______________________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers


_Scanned by MessageLabs

__Scanned by MessageLabs


_Scanned by MessageLabs

__Scanned by MessageLabs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130724/d72a0658/attachment.htm>


More information about the vtkusers mailing list