[vtkusers] Link Error During Subclassing

godach at juno.com godach at juno.com
Fri May 23 18:26:19 EDT 2003


Hello VTKers,

I was learning to create custom callback for picking. First I subclassed vtkCommand:

class PickCommand : public vtkCommand
{
public:
	
static PickCommand *New() { return new PickCommand; }
void Delete(){ delete this; }
virtual void Execute(vtkObject *caller, unsigned long, void*)
{ // some code }
};

It pretty much follows the example in cone6.cxx in the tutorials. However, when calling PickCommand* MyPickCommand = PickCommand::New(), the following error occurred:

--------------------Configuration: wxVTKTest - Win32 Release--------------------
Compiling...
main.cpp
Linking...
xilink6: executing 'C:\PROGRA~1\MICROS~3\VC98\Bin\link.exe'
main.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall vtkObjectBase::GetClassName(void)const " (?GetClassName at vtkObjectBase@@UBEPBDXZ)
Release/wxVTKTest.exe : fatal error LNK1120: 1 unresolved externals
Error executing xilink6.exe.

This error came up even before adding the follow call:

MyPointPicker->AddObserver(vtkCommand::EndPickEvent, MyPickCommand);

I was building this test with static libraries that comes with the windows installer 4.2, and I believe all necessary ones are included:

vtkHybrid.lib vtkRendering.lib vtkGraphics.lib vtkImaging.lib vtkIO.lib vtkFiltering.lib vtkCommon.lib 

A search in the archives showed someone had linking trouble when subclassing:

http://public.kitware.com/pipermail/vtkusers/2001-November/008493.html

I was wondering if anyone has suggestions on how to get rid of the error? Any help is much appreciated! Thanks a lot!

Best wishes,

Daniel


________________________________________________________________
The best thing to hit the internet in years - Juno SpeedBand!
Surf the web up to FIVE TIMES FASTER!
Only $14.95/ month - visit www.juno.com to sign up today!



More information about the vtkusers mailing list