[CMake] Subclass of external library: unresolved external symbol
Marcos
fotosentido at gmail.com
Tue Sep 1 16:02:30 EDT 2015
Hi,
I can use and include VTK libraries in my project, but I did a
vtkInteractorStyleImage subclass, just overriding a method:
#ifndef dcmInteractorStyleImage_h
#define dcmInteractorStyleImage_h
#include "vtkInteractionStyleModule.h" // For export macro
#include "vtkInteractorStyleImage.h"
class VTKINTERACTIONSTYLE_EXPORT dcmInteractorStyle : public
vtkInteractorStyleImage
{
public:
static dcmInteractorStyle *New();
vtkTypeMacro(dcmInteractorStyle, vtkInteractorStyleImage);
virtual void OnLeftButtonDown();
void PrintSelf(ostream& os, vtkIndent indent);
};
#endif
----------------------------------------------------------------
The thing is I use it in a Qt class. So I include this in my CMakeLists.txt:
set(GENERIC_VIEW_CPP
View/UI/dcminteractorstyle.cpp
)
SET(GENERIC_VIEW_H
View/UI/dcminteractorstyle.h
)
add_library(generic ${GENERIC_VIEW_CPP} ${GENERIC_VIEW_H})
...
add_library(ui_qt ${UI_QT_CXX}
${UI_FORM_HEADERS} ${UI_RESOURCES_RCC}
${MODEL_WRAPPED_HEADERS}
${GENERIC_VIEW_CPP} ${GENERIC_VIEW_H} #necesary here?
)
qt5_use_modules(ui_qt Core Gui Widgets)
...
set_source_files_properties(${UI_RESOURCES_RCC} PROPERTIES GENERATED ON)
add_executable(UtilidadDICOM WIN32 main.cpp ${UI_RESOURCES_RCC})
target_link_libraries(UtilidadDICOM
model
ui_qt
generic
${Glue}
${VTK_LIBRARIES}
${ITK_LIBRARIES}
)
------------------------------------------------------------------
The error trying to compile:
ui_qt.lib(viewerwidget.cpp.obj):-1: error: LNK2019: unresolved
external symbol "public: static class dcmInteractorStyle * __cdecl
dcmInteractorStyle::New(void)" (?New at dcmInteractorStyle@@SAPAV1 at XZ)
referenced in function "public: static class vtkSmartPointer<class
dcmInteractorStyle> __cdecl vtkSmartPointer<class
dcmInteractorStyle>::New(void)"
(?New@?$vtkSmartPointer at VdcmInteractorStyle@@@@SA?AV1 at XZ)
ui_qt is a library declared in CMake, as you can see above.
Any ideas? Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150901/46cb7ecd/attachment.html>
More information about the CMake
mailing list