[vtkusers] error LNK2019: unresolved external symbol "__declspec(dllimport)

Vijayakumar C vijaydrdo at gmail.com
Fri Sep 15 23:46:06 EDT 2006


Hello  Every one

I need a help. I am new to VTK and iam trying to use it with MFC. I  was
just trying to run the Example program "Cone" in MFC.  I have attached all
the lib. But when i tried to compile my codes in visual c++.net 2003, i was
getting an error:

VTK1.obj : error LNK2019: unresolved external symbol "__declspec(dllimport)
public: static class vtkConeSource * __cdecl vtkConeSource::New(void)"
(__imp_?New at vtkConeSource@@SAPAV1 at XZ) referenced in function _main
Debug/VTK1.exe : fatal error LNK1120: 1 unresolved externals


Can you please help me.


The Codes of Mine is:


int main( int argc, char *argv[])
{


  //
  // The pipeline creation is documented in Step1
  //
 vtkConeSource *cone=vtkConeSource::New();

  cone->SetHeight( 3.0 );
  cone->SetRadius( 1.0 );
  cone->SetResolution( 10 );
  vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
  coneMapper->SetInput( cone->GetOutput() );
  vtkActor *coneActor = vtkActor::New();
  coneActor->SetMapper( coneMapper );
  vtkRenderer *ren1= vtkRenderer::New();
  ren1->AddActor( coneActor );
  ren1->SetBackground( 0.1, 0.2, 0.4 );
  vtkRenderWindow *renWin = vtkRenderWindow::New();
  renWin->AddRenderer( ren1 );
  renWin->SetSize( 300, 300 );
  // Here is where we setup the observer, we do a new and ren1 will
  // eventually free the observer
  vtkMyCallback *mo1 = vtkMyCallback::New();
  ren1->AddObserver(vtkCommand::StartEvent,mo1);
  mo1->Delete();
  //
  // now we loop over 360 degrees and render the cone each time
  //
  int i;
  for (i = 0; i < 360; ++i)
    {
    // render the image
    renWin->Render();
    // rotate the active camera by one degree
    ren1->GetActiveCamera()->Azimuth( 1 );
    }
  //
  // Free up any objects we created
  //
  cone->Delete();
  coneMapper->Delete();
  coneActor->Delete();
  ren1->Delete();
  renWin->Delete();
  return 0;
}

The header File:



#pragma once

#include "resource.h"
#include "vtkConeSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkCommand.h"
#include "vtkCamera.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
class vtkMyCallback : public vtkCommand
{
public:
  static vtkMyCallback *New()
    {
  return new vtkMyCallback;
 }
  virtual void Execute(vtkObject *caller, unsigned long, void*)
    {
      vtkRenderer *renderer = reinterpret_cast<vtkRenderer*>(caller);
      cout << renderer->GetActiveCamera()->GetPosition()[0] << " "
           << renderer->GetActiveCamera()->GetPosition()[1] << " "
           << renderer->GetActiveCamera()->GetPosition()[2] << "\n";
    }
};


With regards
Vijayakumar
AFMC
Pune
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060916/0636f4d3/attachment.htm>


More information about the vtkusers mailing list