[vtkusers] vtk6 porting question (segfault)

Bill Lorensen bill.lorensen at gmail.com
Tue Aug 14 13:48:47 EDT 2012


PLease keep repiles on the list.

For VTK6 use:

${VTK_LIBRARIES} instead of vtkRendering

On Tue, Aug 14, 2012 at 1:02 PM, Trevor Irons <trevorirons at gmail.com> wrote:

> Hi Bill! Wow.
>
> I guess this is the underlying question. I enabled build examples in
> CMake. But I honestly can't find where these are compiled to. My example is
> from
>
> VTKSOURCE/Examples/Tutorial/Step1/Cxx/Cone.cxx
>
> And the CMakeLists there specifies
>
> PROJECT (Step1)
>
> IF(NOT VTK_BINARY_DIR)
> FIND_PACKAGE(VTK REQUIRED)
> IF(NOT VTK_USE_RENDERING)
>   MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME} requires
> VTK_USE_RENDERING.")
> ENDIF(NOT VTK_USE_RENDERING)
> INCLUDE(${VTK_USE_FILE})
> ENDIF(NOT VTK_BINARY_DIR)
>
> ADD_EXECUTABLE(Cone Cone.cxx)
> TARGET_LINK_LIBRARIES(Cone vtkRendering)
>
> But vtkRendering I think is a pre 6.0 library? Where in the build
> directory are the Examples built? Is there an updated CmakeLists file there?
>
> Thanks so much,
>
> -- Trevor
>
>
>
>
> On 14 August 2012 16:51, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>
>> Have you tried building your example with CMake. I suspect you are
>> missing some libraries.
>>
>> On Tue, Aug 14, 2012 at 11:47 AM, Trevor Irons <trevorirons at gmail.com>wrote:
>>
>>> Sorry if this has been asked before, but I couldn't find it.
>>>
>>> I am having trouble porting an application over to VTK 6.0. I followed
>>> the guide at
>>> http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide
>>>
>>> I am able to get my project to compile but I hit a seg fault at
>>> execution. As a minimal example consider a pared down Cone.cxx from the
>>> Examples
>>>
>>> // First include the required header files for the VTK classes we are
>>> using.
>>> #include "vtkConeSource.h"
>>> #include "vtkPolyDataMapper.h"
>>>
>>> int main()
>>> {
>>>
>>>   vtkConeSource *cone = vtkConeSource::New();
>>>   cone->SetHeight( 3.0 );
>>>   cone->SetRadius( 1.0 );
>>>   cone->SetResolution( 10 );
>>>
>>>   vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
>>>   coneMapper->SetInputConnection( cone->GetOutputPort() );
>>>   //coneMapper->SetInputData( cone->GetOutput()
>>> );                         // I tried this too
>>>
>>>   exit(0);
>>>
>>> }
>>>
>>> I have been compiling with
>>>
>>> g++ Cone.cxx -g -g3  -o testit  -I/usr/local/include/vtk-6.0/
>>> -lvtkRenderingCore-6.0  -lvtkFiltersSources-6.0
>>> -lvtkCommonExecutionModel-6.0
>>>
>>> on
>>>
>>> g++ --version
>>> g++ (GCC) 4.7.1 20120721 (prerelease)
>>> Copyright (C) 2012 Free Software Foundation, Inc.
>>> This is free software; see the source for copying conditions.  There is
>>> NO
>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>> PURPOSE.
>>>
>>> And when I execute, I just see a segmentation fault. I assume I am doing
>>> something wrong, but I can't figure out what.
>>>
>>> I ran it through gdb, but it just said the fault was in
>>> SetInputConnection, or SetInputData, I tried both. This is with the tip of
>>> VTK from the git repository.
>>>
>>> Thanks for any suggestions.
>>>
>>> -- Trevor
>>>
>>>
>>> _______________________________________________
>>> Powered by 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
>>
>>
>


-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120814/a0099ea7/attachment.htm>


More information about the vtkusers mailing list