[vtkusers] Help: Problem compiling example code

Huiqun Zhou hqzhou at nju.edu.cn
Tue Jul 8 06:05:49 EDT 2003


Hi, Lina

As the error message stated, you need to recast the data type.
Here is a code snippet as an example,
  ......
  // create a sphere for all to use
  vtkSphereSource *aSphere = vtkSphereSource::New();
    aSphere->SetPhiResolution(100); 
    aSphere->SetThetaResolution(100); 

  // create texture coordianates for all
  vtkImplicitTextureCoords *tcoords = vtkImplicitTextureCoords::New();
      tcoords->SetInput((vtkDataSet *)aSphere->GetOutput());
  ......

You also need to include the header file vtkProperty.h in your code,

#include "vtkProperty.h"

Hope this help you.

Huiqun Zhou

  ----- Original Message ----- 
  From: Lina 
  To: vtkusers at vtk.org 
  Sent: Saturday, July 05, 2003 11:29 PM
  Subject: [vtkusers] Help: Problem compiling example code


  Hi all,
  I'm a newbie at this. When compiling the example code available on the vtk website for visualizing a quadric function, I get the following errors. 
  Compiling...
  Quadric.cpp
  G:\wolken\vtk\Quadric\Quadric.cpp(26) : error C2664: 'SetInput' : cannot convert parameter 1 from 'class vtkImageData *' to 'class vtkDataSet *'
          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
  G:\wolken\vtk\Quadric\Quadric.cpp(42) : error C2664: 'SetInput' : cannot convert parameter 1 from 'class vtkImageData *' to 'class vtkDataSet *'
          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
  G:\wolken\vtk\Quadric\Quadric.cpp(51) : error C2027: use of undefined type 'vtkProperty'
          g:\program files\vtk42\include\vtk\vtkactor.h(42) : see declaration of 'vtkProperty'
  G:\wolken\vtk\Quadric\Quadric.cpp(51) : error C2227: left of '->SetColor' must point to class/struct/union

  Could somebody please help me with this?
  Thanks!


------------------------------------------------------------------------------
  Do you Yahoo!?
  SBC Yahoo! DSL - Now only $29.95 per month!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030708/aec429d7/attachment.htm>


More information about the vtkusers mailing list