Skip to content

COMP: DisplayableManager: Fix windows link error

Created by: jcfr

This commit fixes "redefinition; different linkage" error reported on windows. The regression was introduced in r26458 (COMP: Support VTK 8.1 updating displayable manager to use vtkObjectFactory)

It implements the following changes:

  • It removes redundant include of ObjectFactory implementation from export header. Since it is already part of the translation unit, there is no need to add it again here.

  • It disables the export of object factory AutoInit_Construct and AutoInit_Destruct symbols. Since the factory is initialized in the same translation unit using "VTK_AUTOINIT", these symbols do not need to be exported.

  • It also fixes a typo in vtkMRMLDisplayableManagerExport.h changing VTKMRMLDisplayableManager_STATIC into MRMLDisplayableManager_STATIC.

Content of the error:

C:\S4R\Slicer-build\Libs\MRML\DisplayableManager\MRMLDisplayableManagerObjectFactory.cxx(106): error C2375: 'MRMLDisplayableManager_AutoInit_Construct' : redefinition; different linkage [C:\S4R\Slicer-build\Libs\MRML\DisplayableManager\MRMLDisplayableManager.vcxproj] [C:\S4R\Slicer.vcxproj]

            C:\S4\Libs\MRML\DisplayableManager\vtkMRMLDisplayableManagerExport.h(32) : see declaration of 'MRMLDisplayableManager_AutoInit_Construct'

C:\S4R\Slicer-build\Libs\MRML\DisplayableManager\MRMLDisplayableManagerObjectFactory.cxx(121): error C2375: 'MRMLDisplayableManager_AutoInit_Destruct' : redefinition; different linkage [C:\S4R\Slicer-build\Libs\MRML\DisplayableManager\MRMLDisplayableManager.vcxproj] [C:\S4R\Slicer.vcxproj]

            C:\S4\Libs\MRML\DisplayableManager\vtkMRMLDisplayableManagerExport.h(32) : see declaration of 'MRMLDisplayableManager_AutoInit_Destruct'

Reported-by: Andras Lasso lasso@queensu.ca

Merge request reports