[CMake] Subclass of external library: unresolved external symbol
Jakob van Bethlehem
jsvanbethlehem at gmail.com
Wed Sep 2 02:36:31 EDT 2015
Hej,
Seems to me at first sight you didn’t implement the New() function
Greetsz, Jakob
> On 01 Sep 2015, at 22:02, Marcos <fotosentido at gmail.com> wrote:
>
> 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.
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150902/59558513/attachment-0001.html>
More information about the CMake
mailing list