[vtkusers] Linking error with simple volume rendering program

Mark Wyszomierski markww at gmail.com
Fri May 13 20:20:04 EDT 2005


Have you linked to vtkFiltering.lib & vtkIO.lib?

Mark

On 5/13/05, rywchiu <rywchiu at interchange.ubc.ca> wrote:
> Hi,
> 
> I'm trying to convert the SimplyRayCast volume rendering example from Tcl to C++.  I've looked at similar previous threads(http://public.kitware.com/pipermail/vtkusers/2003-July/068453.html) and made the appropriate adjustments that were recommended. However, I'm still getting the following errors:
> 
> error LNK2019: unresolved external symbol "public: class vtkStructuredPoints * __thiscall vtkStructuredPointsReader::GetOutput(void)" (?GetOutput at vtkStructuredPointsReader@@QAEPAVvtkStructuredPoints@@XZ) referenced in function _main
> 
> error LNK2019: unresolved external symbol "public: static class vtkStructuredPointsReader * __cdecl vtkStructuredPointsReader::New(void)" (?New at vtkStructuredPointsReader@@SAPAV1 at XZ) referenced in function _main
> D
> 
> Here's my code:
> 
> #include "vtkStructuredPoints.h"
> #include "vtkStructuredPointsReader.h"
> #include "vtkPiecewiseFunction.h"
> #include "vtkColorTransferFunction.h"
> #include "vtkVolumeProperty.h"
> #include "vtkVolumeRayCastCompositeFunction.h"
> #include "vtkVolumeRayCastMapper.h"
> #include "vtkVolume.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderWindowInteractor.h"
> #include "vtkRenderer.h"
> #include "vtkCamera.h"
> #include "vtkInteractorStyleTrackballCamera.h"
> 
> int main( int argc, char *argv[] )
> {
>  vtkStructuredPointsReader *reader;
>  reader = vtkStructuredPointsReader::New();
>  reader->SetFileName("C:/VTK/Examples/Samples/ironProt.vtk");
> 
>  vtkPiecewiseFunction *opacityTF;
>  opacityTF = vtkPiecewiseFunction::New();
>  opacityTF->AddPoint(20, 0.0);
>  opacityTF->AddPoint(255, 0.2);
> 
>  vtkColorTransferFunction *colorTF;
>  colorTF = vtkColorTransferFunction::New();
>  colorTF->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
>  colorTF->AddRGBPoint(64.0, 1.0, 0.0, 0.0);
>  colorTF->AddRGBPoint(128.0, 0.0, 0.0, 1.0);
>  colorTF->AddRGBPoint(192.0, 0.0, 1.0, 0.0);
>  colorTF->AddRGBPoint(255.0, 0.0, 0.2, 0.0);
> 
>  vtkVolumeProperty *volumeProperty;
>  volumeProperty = vtkVolumeProperty::New();
>  volumeProperty->SetColor(colorTF);
>  volumeProperty->SetScalarOpacity(opacityTF);
>  volumeProperty->ShadeOn();
>  volumeProperty->SetInterpolationTypeToLinear();
> 
>  vtkVolumeRayCastCompositeFunction *compositeFunction;
>  compositeFunction = vtkVolumeRayCastCompositeFunction::New();
> 
>  vtkVolumeRayCastMapper *volumeMapper;
>  volumeMapper = vtkVolumeRayCastMapper::New();
>  volumeMapper->SetVolumeRayCastFunction(compositeFunction);
>  volumeMapper->SetInput(reader->GetOutput());
> 
>  vtkVolume *volume;
>  volume = vtkVolume::New();
>  volume->SetMapper(volumeMapper);
>  volume->SetProperty(volumeProperty);
> 
>  vtkRenderer *ren1= vtkRenderer::New();
>  ren1->AddVolume( volume );
>  ren1->SetBackground( 1, 1, 1 );
> 
>  vtkRenderWindow *renWin = vtkRenderWindow::New();
>  renWin->AddRenderer( ren1 );
>  renWin->SetSize( 600, 600 );
> 
>  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>  iren->SetRenderWindow(renWin);
> 
>  vtkInteractorStyleTrackballCamera *style =
>  vtkInteractorStyleTrackballCamera::New();
>  iren->SetInteractorStyle(style);
> 
>  iren->Initialize();
>  renWin->Render();
>  iren->Start();
> 
>  reader->Delete();
>  opacityTF->Delete();
>  colorTF->Delete();
>  volumeProperty->Delete();
>  volumeMapper->Delete();
>  volume->Delete();
>  ren1->Delete();
>  renWin->Delete();
>  iren->Delete();
>  style->Delete();
> 
>  return 0;
> }
> 
> Any idea on what is causing those errors? I suspect it has to do with this line:
> 
>  volumeMapper->SetInput(reader->GetOutput());
> 
> and that the data types are not matching.  However, according to the previous threads, the above code should work fine...
> 
> Thanks and Regards,
> Rita
> 
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list