[vtkusers] Link errors in volProt.cxx ezample

Leonid Dulman leonid_dulman at yahoo.co.uk
Fri Jan 14 01:47:11 EST 2011


Hi to all
I tried to compile and execut vopProt.cxx example

#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkStructuredPointsReader.h"
#include "vtkPiecewiseFunction.h"
#include "vtkVolumeProperty.h"
#include "vtkVolumeRayCastCompositeFunction.h"
#include "vtkVolumeRayCastMapper.h"
#include "vtkVolume.h"
#include "vtkCamera.h"

#include "SaveImage.h"

int main( int argc, char *argv[] )
{
  // Create the renderer, render window, and interactor
  vtkRenderer *ren1 = vtkRenderer::New();
  vtkRenderWindow *renWin = vtkRenderWindow::New();
    renWin->AddRenderer(ren1);
  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);

  // Read the data from a vtk file
  vtkStructuredPointsReader *reader = vtkStructuredPointsReader::New();
    reader->SetFileName("../../../vtkdata/ironProt.vtk");
    reader->Update();

  // Create a transfer function mapping scalar value to opacity
  vtkPiecewiseFunction *oTFun = vtkPiecewiseFunction::New();
    oTFun->AddSegment(80, 0.0, 255, 1.0);

  // Create a transfer function mapping scalar value to color (grey)
  vtkPiecewiseFunction *cTFun = vtkPiecewiseFunction::New();
    cTFun->AddSegment(0, 1.0, 255, 1.0);

  // Create a property for the volume and set the transfer functions.
  // Turn shading on and use trilinear interpolation
  vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
    volumeProperty->SetColor(cTFun);
    volumeProperty->SetScalarOpacity(oTFun);
    volumeProperty->SetInterpolationTypeToLinear();
    volumeProperty->ShadeOn();

  // Create a ray function - this is a compositing ray function
  vtkVolumeRayCastCompositeFunction *compositeFunction = 
    vtkVolumeRayCastCompositeFunction::New();

  // Create the volume mapper and set the ray function and scalar input
  vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();
    volumeMapper->SetInput((vtkImageData *)reader->GetOutput());
    volumeMapper->SetVolumeRayCastFunction(compositeFunction);

  // Create the volume and set the mapper and property
  vtkVolume *volume = vtkVolume::New();
    volume->SetMapper(volumeMapper);
    volume->SetProperty(volumeProperty);

  // Add this volume to the renderer and get a closer look
  ren1->AddVolume(volume);
  ren1->GetActiveCamera()->Azimuth(20.0);
  ren1->GetActiveCamera()->Dolly(1.60);
  ren1->ResetCameraClippingRange();
  
  renWin->SetSize(300,300);

  renWin->Render();

  SAVEIMAGE( renWin );

  // Interact with the data at 3 frames per second
  iren->SetDesiredUpdateRate(3.0);
  iren->SetStillUpdateRate(0.001);
  iren->Start();

  // Clean up
  ren1->Delete();
  renWin->Delete();
  iren->Delete();
  reader->Delete();
  oTFun->Delete();
  cTFun->Delete();
  volumeProperty->Delete();
  compositeFunction->Delete();
  volumeMapper->Delete();
  volume->Delete();
}

But have got errors on link :

Microsoft (R) Incremental Linker Version 10.00.20506.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:volprot.exe 
/out:volprot.exe 
volprot.obj 
d:\vtk\lib\vtkRendering.lib 
d:\vtk\lib\vtkCommon.lib 
d:\vtk\lib\vtkFiltering.lib 
d:\vtk\lib\vtkIO.lib 
d:\vtk\lib\vtkImaging.lib 
d:\vtk\lib\vtkGraphics.lib 
d:\vtk\lib\vtkWidgets.lib 
d:\vtk\lib\vtkInfovis.lib 
volprot.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class vtkVolumeRayCastMapper * __cdecl vtkVolumeRayCastMapper::New(void)" (__imp_?New at vtkVolumeRayCastMapper@@SAPAV1 at XZ) referenced in function _main
volprot.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class vtkVolumeRayCastCompositeFunction * __cdecl vtkVolumeRayCastCompositeFunction::New(void)" (__imp_?New at vtkVolumeRayCastCompositeFunction@@SAPAV1 at XZ) referenced in function _main
volprot.exe : fatal error LNK1120: 2 unresolved externals

How to solve this problem? Thank you. Leonid




      



More information about the vtkusers mailing list