[vtkusers] Help on writing a graphics filter
David Cole
david.cole at kitware.com
Thu Apr 17 13:44:09 EDT 2008
You can't use the VTK_GRAPHICS_EXPORT macro unless your class is built into
the vtkGraphics library itself. Make up your own equivalent macro for your
library...
On Thu, Apr 17, 2008 at 1:36 PM, Renato N. Elias <rnelias at nacad.ufrj.br>
wrote:
>
> 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<http://www.nacad.ufrj.br/%7Ernelias/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.
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080417/b4ad4310/attachment.htm>
More information about the vtkusers
mailing list