[vtkusers] Help on writing a graphics filter

Renato N. Elias rnelias at nacad.ufrj.br
Thu Apr 17 13:36:35 EDT 2008


Hi folks,

I'm trying to write a simple graphics filter which takes a DataSet, 
compute something and add a CellData array to the output's DataSet. The 
structure of the filter is quite the same the vtkElevationFilter, so, I 
just copied the .cxx and .h and changed some stuffs.

Here is the my header created from vtkElevationFilter.h: (all files are 
here 
http://www.nacad.ufrj.br/~rnelias/transfer/ColorBoundaryRegionsFilter.zip )

//--------------------------------------------------------------
#ifndef __vtkColorBoundaryRegionsFilter_h
#define __vtkColorBoundaryRegionsFilter_h

#include "vtkDataSetAlgorithm.h"

class VTK_GRAPHICS_EXPORT vtkColorBoundaryRegionsFilter : public 
vtkDataSetAlgorithm
{
public:
  static vtkColorBoundaryRegionsFilter* New();
  vtkTypeRevisionMacro(vtkColorBoundaryRegionsFilter, vtkDataSetAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent);

protected:
  vtkColorBoundaryRegionsFilter();
  ~vtkColorBoundaryRegionsFilter();

  int RequestData(vtkInformation*,
                  vtkInformationVector**,
                  vtkInformationVector*);

private:
  vtkColorBoundaryRegionsFilter(const vtkColorBoundaryRegionsFilter&);  
// Not implemented.
  void operator=(const vtkColorBoundaryRegionsFilter&);  // Not implemented.
};

#endif
//--------------------------------------------------------------

The filter's algorithm is implemented in the RequestData method. My 
CMakeLists file is as follows:

#---------------------------------------------------------------
PROJECT(ColorBoundaryRegionsFilter)
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
ADD_LIBRARY(ColorBoundaryRegionsFilter vtkColorBoundaryRegionsFilter.cxx)
ADD_EXECUTABLE(test test.cxx vtkColorBoundaryRegionsFilter.cxx)
#---------------------------------------------------------------

I can have the filter compiled as library, the problem happens when I 
try to link with the following test program (. The linker gives me a 
bunch of error messages

int main() {
vtkColorBoundaryRegionsFilter* br = vtkColorBoundaryRegionsFilter::New();
br-Delete();
}

Linker error:

1>vtkColorBoundaryRegionsFilter.obj : error LNK2019: unresolved external 
symbol "public: void __thiscall 
vtkDataArrayTemplate<int>::InsertValue(int,int)" 
(?InsertValue@?$vtkDataArrayTemplate at H@@QAEXHH at Z) referenced in function 
"public: void __thiscall vtkIntArray::InsertValue(int,int)" 
(?InsertValue at vtkIntArray@@QAEXHH at Z)
1>vtkColorBoundaryRegionsFilter.obj : error LNK2019: unresolved external 
symbol "public: virtual __thiscall 
vtkOStreamWrapper::~vtkOStreamWrapper(void)" 
(??1vtkOStreamWrapper@@UAE at XZ) referenced in function "protected: 
virtual void __thiscall 
vtkColorBoundaryRegionsFilter::CollectRevisions(class 
std::basic_ostream<char,struct std::char_traits<char> > &)" 
(?CollectRevisions at vtkColorBoundaryRegionsFilter@@MAEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@@Z)
1>vtkColorBoundaryRegionsFilter.obj : error LNK2019: unresolved external 
symbol "public: class vtkOStreamWrapper & __thiscall 
vtkOStreamWrapper::operator<<(char const *)" 
(??6vtkOStreamWrapper@@QAEAAV0 at PBD@Z) referenced in function "protected: 
virtual void __thiscall 
vtkColorBoundaryRegionsFilter::CollectRevisions(class 
std::basic_ostream<char,struct std::char_traits<char> > &)" 
(?CollectRevisions at vtkColorBoundaryRegionsFilter@@MAEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@@Z)
1>vtkColorBoundaryRegionsFilter.obj : error LNK2019: unresolved external 
symbol "protected: virtual void __thiscall 
vtkDataSetToDataSetFilter::CollectRevisions(class 
std::basic_ostream<char,struct std::char_traits<char> > &)" 
(?CollectRevisions at vtkDataSetToDataSetFilter@@MAEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@@Z) 
referenced in function "protected: virtual void __thiscall 
vtkColorBoundaryRegionsFilter::CollectRevisions(class 
std::basic_ostream<char,struct std::char_traits<char> > &)" 
(?CollectRevisions at vtkColorBoundaryRegionsFilter@@MAEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@@Z)
1>vtkColorBoundaryRegionsFilter.obj : error LNK2019: unresolved external 
symbol "public: __thiscall vtkOStreamWrapper::operator class 
std::basic_ostream<char,struct std::char_traits<char> > &(void)" 
(??BvtkOStreamWrapper@@QAEAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@XZ) 
referenced in function "protected: virtual void __thiscall 
vtkColorBoundaryRegionsFilter::CollectRevisions(class 
std::basic_ostream<char,struct std::char_traits<char> > &)" 
(?CollectRevisions at vtkColorBoundaryRegionsFilter@@MAEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@@Z)
1>vtkColorBoundaryRegionsFilter.obj : error LNK2019: unresolved external 
symbol "public: __thiscall vtkOStreamWrapper::vtkOStreamWrapper(class 
std::basic_ostream<char,struct std::char_traits<char> > &)" 
(??0vtkOStreamWrapper@@QAE at AAV?$basic_ostream at DU?$char_traits at D@std@@@std@@@Z) 
referenced in function "protected: virtual void __thiscall 
vtkColorBoundaryRegionsFilter::CollectRevisions(class 
std::basic_ostream<char,struct std::char_traits<char> > &)" 
(?CollectRevisions at vtkColorBoundaryRegionsFilter@@MAEXAAV?$basic_ostream at DU?$char_traits at D@std@@@std@@@Z)
1>vtkColorBoundaryRegionsFilter.obj : error LNK2019: unresolved external 
symbol "protected: __thiscall 
vtkDataSetToDataSetFilter::vtkDataSetToDataSetFilter(void)" 
(??0vtkDataSetToDataSetFilter@@IAE at XZ) referenced in function 
"protected: __thiscall 
vtkColorBoundaryRegionsFilter::vtkColorBoundaryRegionsFilter(void)" 
(??0vtkColorBoundaryRegionsFilter@@IAE at XZ)
1>vtkColorBoundaryRegionsFilter.obj : error LNK2001: unresolved external 
symbol "public: virtual void __thiscall vtkObjectBase::Delete(void)" 
(?Delete at vtkObjectBase@@UAEXXZ)
...

Any idea?

Regards

Renato.



More information about the vtkusers mailing list