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
- Usage of other QmitkNodeDescriptor methods (e.g. GetIcon, GetSeperator) do not provoke a linker error
- Implementation of QmitkNodeDescriptor::GetClassName seems correct and matches the header declaration. This does not explain the missing symbol
- 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()...