[vtkusers] VTK-Win32 problem only : including vtk includes windows.h
REGAT-BARREL Aurélien
arbvtk at yahoo.fr
Wed May 12 05:26:51 EDT 2004
The code above works differently Windows and Linux not because of inclusion of , 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.
You're right, i didn't override GetClassName correctly.
But, now that it is correctly overriden, I get the GetClassNameA problem... and it works.
I wondered how that was possible, and I tried this under Windows :
#include <vtkObjectBase.h>
#include <stdio.h>
#undef GetClassName
class MyEmptyObject : public vtkObjectBase
{
public:
virtual const char * GetClassName() const
{
return "MyEmptyObject";
}
};
int main()
{
vtkObjectBase * o = new MyEmptyObject;
printf( "%s\n", o->GetClassName() );
}
Compiler error : "error C2039: 'GetClassName' : is not a member of 'vtkObjectBase'"
Oh my god... does it means that ...
http://www.chez.com/regatbar/getclassname.png
Yes, all vtk classes implement GetClassNameA and not GetClassName.
And this is also true for
int vtkDirectory::CreateDirectoryA(char const *)
class vtkObject * vtkCollectionIterator::GetObjectA(void)
class vtkProp * vtkAssemblyNode::GetPropA(void)
void vtkViewport::RemovePropA(class vtkProp *)
void vtkAssemblyNode::SetPropA(class vtkProp *)
this is just for vtkCommon.
This works well because all VTK code includes <windows.h>.
But, it is a potential pitfall for user code which does not include vtk everywhere.
That was my case yesterday.
Aurélien REGAT-BARREL
---------------------------------
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail
Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040512/3c891e0c/attachment.htm>
More information about the vtkusers
mailing list