[vtkusers] VC++ 7 Doc/View Architeture & vtkCommand

de Boer Ingo I.deBoer at polytec.de
Thu Jun 3 02:25:52 EDT 2004


Hi,

this looks good to me. I do the same. Mybe you forgot to link
something else? The "iostrini.obj" indicates, that maybe something
is wrong in the compiler flags... Did you compile with ot without
VTK_USE_ANSI_STDLIB ? Do you use the VTK source code or the VTK
setup ?

I'd suggest you compile your file with the VTK_USE_ANSI_STDLIB first...

greets
  Ingo


---
Dr.-Ing. Ingo H. de Boer

Polytec GmbH
Polytec-Platz 1-7, 76337 Waldbronn, Germany
phone: ++49 7243 604 106
fax  : ++49 7243 604 255

1) I created a class in CView.h (CView class):

#include "vtkCommand.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";
    }
};

2) Following, I inserted in constructor of  CView.cpp (CView Class) the code:

  vtkMyCallback *mo1 = vtkMyCallback::New();
  this->ren->AddObserver(vtkCommand::StartEvent,mo1);
  mo1->Delete();

The compilation finish ok, but in link fase, I'm getting follow message:

libcimtd.lib(iostrini.obj) : error LNK2005: "void __cdecl operator delete(void *,int,char const *,int)" (??3 at YAXPAXHPBDH@Z) already defined in nafxcwd.lib(afxmem.obj)
Debug/DgDecor.exe : fatal error LNK1169: one or more multiply defined symbols found

Can anyone help me solve this problem ?

Thanks,

Luis Alberto



More information about the vtkusers mailing list