[vtk-developers] NULL always returned from vtkPolyDataMapper::New()
Bill Lorensen
bill.lorensen at gmail.com
Mon Nov 12 17:45:26 EST 2012
Because of the new factory mechanism in vtk6 you need to
#include "vtkRenderingOpenGL.h"
also
in your CmakeLists.txt file don't add include_directories, just
include(${VTK_USE_FILE})
and for the libraries use
${VTK_LIBRARIES}
On Mon, Nov 12, 2012 at 4:20 PM, Kyle Lutz <kyle.lutz at kitware.com> wrote:
> After adding "include(${VTK_USE_FILE})" right after
> "include_directories(${VTK_INCLUDE_DIRS})" I now get the following
> linker errors:
>
> CMakeFiles/test.dir/main.cpp.o: In function `vtkRenderingCore_AutoInit':
> /home/kyle/VTK/build/Rendering/Core/vtkRenderingCoreModule.h:44:
> undefined reference to `vtkInteractionStyle_AutoInit_Construct()'
> /home/kyle/VTK/build/Rendering/Core/vtkRenderingCoreModule.h:44:
> undefined reference to
> `vtkRenderingFreeTypeOpenGL_AutoInit_Construct()'
> /home/kyle/VTK/build/Rendering/Core/vtkRenderingCoreModule.h:44:
> undefined reference to `vtkRenderingOpenGL_AutoInit_Construct()'
> CMakeFiles/test.dir/main.cpp.o: In function `~vtkRenderingCore_AutoInit':
> /home/kyle/VTK/build/Rendering/Core/vtkRenderingCoreModule.h:44:
> undefined reference to `vtkInteractionStyle_AutoInit_Destruct()'
> /home/kyle/VTK/build/Rendering/Core/vtkRenderingCoreModule.h:44:
> undefined reference to
> `vtkRenderingFreeTypeOpenGL_AutoInit_Destruct()'
> /home/kyle/VTK/build/Rendering/Core/vtkRenderingCoreModule.h:44:
> undefined reference to `vtkRenderingOpenGL_AutoInit_Destruct()'
> collect2: ld returned 1 exit status
>
> :-(. Any other ideas?
>
> -kyle
>
> On Mon, Nov 12, 2012 at 1:16 PM, David Doria <daviddoria at gmail.com> wrote:
>> On Mon, Nov 12, 2012 at 4:09 PM, Kyle Lutz <kyle.lutz at kitware.com> wrote:
>>>
>>> Hello everyone,
>>>
>>> I'm trying to write a small reproducible test case for a bug I'm
>>> working on but I can't even get a simple visualization pipeline
>>> running. When I try to create a vtkPolyDataMapper I always get NULL
>>> returned. I've looked through the wiki and at the VTK6 migration guide
>>> but can't find anything related to what I'm seeing.
>>>
>>> I'm sure I'm doing something wrong but I can't seem to figure out:
>>>
>>> === main.cpp ===
>>> #include <cassert>
>>> #include <vtkPolyDataMapper.h>
>>>
>>> int main()
>>> {
>>> vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
>>> assert(mapper != 0);
>>> return 0;
>>> }
>>>
>>> === CMakeLists.txt ===
>>> find_package(VTK REQUIRED)
>>> include_directories(${VTK_INCLUDE_DIRS})
>>>
>>> add_executable(test main.cpp)
>>> target_link_libraries(test vtkRenderingCore)
>>>
>>> Platform: Ubuntu Linux, 64-bit, GCC 4.6.3, VTK from gerrit/master (as
>>> of this morning)
>>>
>>> I've also tried changing the link line to ${VTK_LIBRARIES} (which
>>> gives the same assertion error) and vtkHybrid (which gives a
>>> "-lvtkHybrid" not found error when linking).
>>>
>>> Any help would be greatly appreciated.
>>>
>>> Thanks,
>>> Kyle
>>
>>
>> I don't know if this would cause the problem, but a line I always use
>> and that is absent in your CMakeLists.txt is:
>>
>> include(${VTK_USE_FILE})
>>
>> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
--
Unpaid intern in BillsBasement at noware dot com
More information about the vtk-developers
mailing list