vtkSlicerTransformLogic access in CLI module

Having a small issue that is driving me crazy and I can’t figure it out. It is such a simple problem, but I can’t seem to remedy the problem.

I am writing a CLI module and need access to the transform module logic. I try to get access to it by doing the following:

#include “qSlicerAbstractModule.h”
#include “qSlicerCoreApplication.h”
#include “qSlicerModuleManager.h”
#include “vtkSlicerTransformLogic.h”
#include <vtkMRMLTransformNode.h>

vtkSlicerTransformLogic* transformLogic= vtkSlicerTransformLogic::SafeDownCast(qSlicerCoreApplication::application()->moduleManager()->module(“transforms”)->logic());

When I try to compile I get this error message “Error 1 error LNK2019: unresolved external symbol “__declspec(dllimport) public: static class vtkSlicerTransformLogic * __cdecl vtkSlicerTransformLogic::SafeDownCast(class vtkObjectBase *)” (_imp?SafeDownCast@vtkSlicerTransformLogic@@SAPEAV1@PEAVvtkObjectBase@@@Z)”

I have been able to access other module logic doing the exact same thing but I just can’t seem to do it for the transform module. What am I missing here?

You need to add transforms logic library to the list of libraries in your CMakeLists.txt.

Duh. Thanks. Haven’t edited my cmake file in awhile in this module. Didn’t even cross my mind. Works now!

1 Like