visual studio - vtk 8.9 lnk2019 vtkvolume setproperty unresolve external symbol

Hello,

I’m trying to render volume data using c++ / vs2015 / vtk master (I cloned it from github and built it in vs2015), but I’m getting a linker error when calling the method vtkVolume::SetProperty
These are the lines of code I’m using:

#include <vtkVolume.h>
#include <vtkVolumeProperty.h>
#include <vtkPiecewiseFunction.h>
#include <vtkColorTransferFunction.h> 
#include <vtkProperty.h> 
..
..
..
vtkSmartPointer<vtkVolumeProperty> volumeProperty = vtkSmartPointer<vtkVolumeProperty>::New();
volumeProperty->SetInterpolationTypeToLinear();
 volumeProperty->SetIndependentComponents(true);
vtkSmartPointer<vtkColorTransferFunction> colorFun = vtkSmartPointer<vtkColorTransferFunction>::New();
  volumeProperty->SetColor(colorFun);
vtkSmartPointer<vtkVolume> volume = vtkSmartPointer<vtkVolume>::New()
volume->SetProperty(volumeProperty);

The compiler error is
Main.obj : error LNK2019: unresolved external symbol “__declspec(dllimport) public: void __cdecl vtkVolume::SetProperty(class vtkVolumeProperty *)” (_imp?SetPropertyvtkVolumeQEAAXPEAVvtkVolumePropertyZ) referenced in function “public: virtual void __cdecl MyVRApp::onRenderGraphicsContext(class MinVR::VRGraphicsState const &)” (?onRenderGraphicsContextMyVRAppUEAAXAEBVVRGraphicsStateMinVRZ)

Yes! I added the libraries to the vs linker (properties->linker->input and properties->linker->Additional Library Directories).
This is the log from the linker in verbose mode. I believe vtkvolume is in the vtkRenderingCore lib, but you’ll see although the linker finds it, it doesnt find the mentioned method:

Searching C:\Program Files\VTK\lib\vtkRenderingCore-8.90d.lib:
Found “__declspec(dllimport) public: void __cdecl vtkProp3D::SetUserTransform(class vtkLinearTransform *)” (_imp?SetUserTransform:vtkProp3DQEAAXPEAVvtkLinearTransformZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: static class vtkVolume * __cdecl vtkVolume::New(void)” (_imp?NewvtkVolumeSAPEAV1XZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: void __cdecl vtkVolume::SetMapper(class vtkAbstractVolumeMapper *)” (_imp?SetMappervtkVolumeQEAAXPEAVvtkAbstractVolumeMapperZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: static class vtkRenderer * __cdecl vtkRenderer::New(void)” (_imp?New:vtkRendererSAPEAV1XZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: void __cdecl vtkRenderer::AddVolume(class vtkProp *)” (_imp?AddVolume:vtkRendererQEAAXPEAVvtkPropZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: void __cdecl vtkRenderer::SetActiveCamera(class vtkCamera *)” (_imp?SetActiveCameravtkRendererQEAAXPEAVvtkCameraZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: class vtkCamera * __cdecl vtkRenderer::GetActiveCamera(void)” (_imp?GetActiveCamera:vtkRendererQEAAPEAVvtkCameraXZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: static class vtkVolumeProperty * __cdecl vtkVolumeProperty::New(void)” (_imp?New:vtkVolumeProperty:SAPEAV1:XZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: void __cdecl vtkVolumeProperty::SetInterpolationTypeToLinear(void)” (_imp?SetInterpolationTypeToLinear:vtkVolumePropertyQEAAXXZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: void __cdecl vtkVolumeProperty::SetColor(class vtkColorTransferFunction *)” (_imp?SetColorvtkVolumeProperty:QEAAXPEAVvtkColorTransferFunction:Z)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: void __cdecl vtkVolumeProperty::SetScalarOpacity(class vtkPiecewiseFunction *)” (_imp?SetScalarOpacity:vtkVolumePropertyQEAAXPEAVvtkPiecewiseFunctionZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: static class vtkColorTransferFunction * __cdecl vtkColorTransferFunction::New(void)” (_imp?NewvtkColorTransferFunctionSAPEAV1XZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found “__declspec(dllimport) public: void __cdecl vtkColorTransferFunction::AddRGBSegment(double,double,double,double,double,double,double,double)” (_imp?AddRGBSegment:vtkColorTransferFunctionQEAAXNNNNNNNNZ)
Referenced in Main.obj
Loaded vtkRenderingCore-8.90d.lib(vtkRenderingCore-8.90d.dll)
Found __IMPORT_DESCRIPTOR_vtkRenderingCore-8.90d

Do you know what I could be missing?

Thanks for the help.

I checked only the library folder path and not the include folder path. I was pointing to an unknown place.

You can close this thread.