Page MenuHomePhabricator

Linker problems with QmitkNodeDescriptor::GetClassName
Closed, ResolvedPublic

Description

The original error report was:

we are porting our modules and plugins from 2014.10 to the current code base for the upcoming release. Now we have a strange linker error with VS2013.

In the activator of a plugin I register an icon for a new data type (analog to the PlanarFigure plugin).

With the new MITK code base I get following linker error

error LNK2001: Nicht aufgelöstes externes Symbol ""public: virtual class QString __cdecl QmitkNodeDescriptor::GetClassName(void)const " (?GetClassName@QmitkNodeDescriptor@@UEBA?AVQString@@XZ)".

The cmake of my plugin does enlist a module dependency to MitkQtWidgets:

mitk_create_plugin(

EXPORT_DIRECTIVE M4C_MITK_CORE_HELPER_EXPORT
EXPORTED_INCLUDE_SUFFIXES src
MODULE_DEPENDS MitkQtWidgets MitkQtWidgetsExt Map4MITK
PACKAGE_DEPENDS Qt4|QtUiTools Qt5|UiTools

)

In the VS project properties “MitkQtWidgets.lib” is correctly listed as dependency.

What makes it particularly strange is that

  1. Usage of other QmitkNodeDescriptor methods (e.g. GetIcon, GetSeperator) do not provoke a linker error
  1. Implementation of QmitkNodeDescriptor::GetClassName seems correct and matches the header declaration. This does not explain the missing symbol
  1. MITK itself (including Planar figures) build with no errors.

Any hints or clues regarding this problem are appreciated.

Thanks,
Ralf

The reason is that GetClassName is #define'd in winuser.h which substitutes it with GetClassNameA or GetClassNameW.

The solution of changeing the include order is not applicibal because it leads to an ohter conflict (poco is complaining with an "undefined windows" compiler error.

After discussing it in the mitk meeting the best solutions seems to add a GetNameOfClass method to QmitkNodeDescriptor and let the QmitkNodeDescriptorManager use the unconflicted method.
To get rid of this, just replace this with GetNameOfClass()...

Event Timeline

User floca has pushed new remote branch:

bug-19207-Linker-problem-with-QmitkNodeDescriptor-GetClassName

User goch has pushed new remote branch:

bug-19207-Linker-problem-with-QmitkNodeDescriptor-GetClassName-2

[c2eddc]: Merge branch 'bug-19207-Linker-problem-with-QmitkNodeDescriptor-GetCla

Merged commits:

2015-07-31 18:28:52 Ralf Floca [69c7c3]

Signed-off-by: Ralf Floca <r.floca@dkfz-heidelberg.de>