[vtkusers] VTK-Win32 problem only : including vtk includes windows.h
    Alexander Fiksel 
    alexf at coherentsolutions.com
       
    Tue May 11 13:20:07 EDT 2004
    
    
  
*****
        #include <vtkObjectBase.h>
        #include <stdio.h>
        class MyEmptyObject : public vtkObjectBase
        {
        public:
            virtual const char * GetClassName()
            {
                return "MyEmptyObject";
            }
        };
       
        int main()
        {
            vtkObjectBase * o = new MyEmptyObject;
            printf( "%s\n", o->GetClassName() );
        }
        But under Windows I get "vtkObjectBase", and because <windows.h> is included in <vtkObjectBase.h> before declaring vtkObjectBase::GetClassName, I don't know how to solve it.
******
The code above works differently Windows  and Linux not because of inclusion of <windows.h>, but because of differences in compilers. The problem is that you overrode the GetClassName incorrectly - the correct signature should be  const char* GetClassName() const and this code works as it was intended. The Linux compiler wasn't sophisticated enough to catch the difference
Alex 
    
    
More information about the vtkusers
mailing list