[vtkusers] derive my own class from vtk in mfc

bxb1280 bxb1280 at sohu.com
Mon Mar 11 22:02:21 EST 2002


vtkusers,hi
      I want to derive a class from VTK class in VC++,but it produce a lot of linking error .
for example .I derive a class(named vtkmyObject) from vtkObject in VC++,but it produces following  error.  Can you tell me how to derive my own class from vtk?
thanks for your help.
//*****************************
  vtkmyobject.h
//*****************************
// vtkmyobject.h: interface for the vtkmyobject class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_VTKMYOBJECT_H__E892D705_329D_11D6_AE8C_0050BA5964A3__INCLUDED_)
#define AFX_VTKMYOBJECT_H__E892D705_329D_11D6_AE8C_0050BA5964A3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "vtkobject.h"
class vtkmyobject : public vtkObject  
{
public:
	vtkmyobject();
	virtual ~vtkmyobject();

};

#endif // !defined(AFX_VTKMYOBJECT_H__E892D705_329D_11D6_AE8C_0050BA5964A3__INCLUDED_)

//*********************
vtkmyobject.cpp
//**********************

// vtkmyobject.cpp: implementation of the vtkmyobject class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "SinoVol.h"
#include "vtkmyobject.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

vtkmyobject::vtkmyobject()
{

}

vtkmyobject::~vtkmyobject()
{

}

//*************************************************************************************
                linking error
//***************************************************************************************

           Deleting intermediate files and output files for project 'SinoVol - Win32 Debug'.
--------------------Configuration: SinoVol - Win32 Debug--------------------
Compiling resources...
Compiling...
StdAfx.cpp
Automatically linking with BCGCB58d.dll
Compiling...
MainFrm.cpp
SinoVol.cpp
SinoVolDoc.cpp
SinoVolView.cpp
WorkspaceBar.cpp
vtkmyobject.cpp
Generating Code...
Linking...
vtkmyobject.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall vtkObject::PrintTrailer(class ostream &,class vtkIndent)" (?PrintTrailer at vtkObject@@UAEXAAVostream@@VvtkIndent@@@Z)
vtkmyobject.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall vtkObject::PrintHeader(class ostream &,class vtkIndent)" (?PrintHeader at vtkObject@@UAEXAAVostream@@VvtkIndent@@@Z)
vtkmyobject.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall vtkObject::PrintSelf(class ostream &,class vtkIndent)" (?PrintSelf at vtkObject@@UAEXAAVostream@@VvtkIndent@@@Z)
Debug/SinoVol.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.
Creating browse info file...

SinoVol.exe - 4 error(s), 0 warning(s)

 				
              bxb1280
              bxb1280 at sohu.com
                 2002-03-08


More information about the vtkusers mailing list