[vtkusers] VTK and QT tested on Mac

Alain CORON alain.coron at lip.bhdc.jussieu.fr
Tue Jul 15 05:42:39 EDT 2003

"Bert Schiettecatte" <bert.schiettecatte at esat.kuleuven.ac.be> writes:

> Hi Carsten,
> I tried downloading the qmake version of the library (used on macos X
> normally) and I changed the qmake project file to work on my win xp with
> vtk 4.2 and qt 3.1.1. When I try to compile the library using MS VC .
> NET 2002 I get the following warnings:
> vtkQGLLight.cxx(35) : warning C4273: 'vtkQGLLight::CollectRevisions' :
> inconsistent dll linkage
> vtkQGLLight.cxx(36) : warning C4273: 'vtkQGLLight::New' : inconsistent
> dll linkage
> vtkQGLLight.cxx(41) : warning C4273: 'vtkQGLLight::Render' :
> inconsistent dll linkage
> when I try to compile the cylinder example I get 
> cylinder_vtkqt error LNK2019: unresolved external symbol
> "__declspec(dllimport) public: static class vtkQGLLight * __cdecl
> vtkQGLLight::New(void)" (__imp_?New at vtkQGLLight@@SAPAV1 at XZ) referenced
> in function "protected: virtual class vtkObject * __thiscall
> vtkQtObjectFactory::CreateObject(char const *)"
> (?CreateObject at vtkQtObjectFactory@@MAEPAVvtkObject@@PBD at Z)
> Anybody have any idea what the problem could be? 


Have a look at vtkQGLLight.h line 30, you will see

class VTK_RENDERING_EXPORT vtkQGLLight : public vtkOpenGLLight

The macro VTK_RENDERING_EXPORT is a Windows specific macro defined in
vtkWin32Header.h by

     #if defined(vtkRendering_EXPORTS)
      #define VTK_RENDERING_EXPORT __declspec( dllexport ) 
      #define VTK_RENDERING_EXPORT __declspec( dllimport ) 

On the other system it expands to nothing.

On Windows you must explicitly export the classes and the global functions
which you want to be publicly accessible.  So if vtkRendering_EXPORTS is
defined, then you explicitly export vtkQGLLight.  Otherwise you don't.

It seems that your CMake does not define this macro.  

However I think that it should be better if vtk_qt use its own macro to
export its own classes and functions.  This macro should also be added to the
other classes.

Alain CORON            mailto:alain.coron at lip.bhdc.jussieu.fr
Laboratoire d'Imagerie Paramétrique - UMR CNRS 7623
15, rue de l'école de médecine - 75006 PARIS
tél. : +33 1 44 41 96 10 - fax. : +33 1 46 33 56 73

More information about the vtkusers mailing list