Reputation: 3
I'm using VTK to read a DICOM series. I can compile (using CMake) VTK example code and it runs well. Now, I'm trying to use Qtcreator and Qt4.8.5 to create a GUI. I have linked the library and include path on project.pro.
When I build, I get:
Undefined symbols:
"vtkImageViewer2::New()", referenced from:
vtkSmartPointer<vtkImageViewer2>::New() in mainwindow.o
ld: symbol(s) not found
I checked, the Include path, and it includes /usr/local/vtk-6.1/include/vtk-6.1/ which contains vtkImageViewer2.h.
What's wrong with my project?
Upvotes: 0
Views: 428
Reputation: 21
As an addendum to David's answer, do not forgot to add ${VTK_LIBRARIES} (defined by the VTK Use file) to your library or binary/executable:
TARGET_LINK_LIBRARIES(myLib ${VTK_LIBRARIES})
and the paths to the libraries as:
link_directories(${VTK_LIBRARY_DIRS})
Upvotes: 0
Reputation: 10273
That is a linker error, so your project is indeed finding vtkImageViewer2.h correctly. You should use CMake to create your project, then you can simply do
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
and all of the VTK linking will be taken care of for you.
Upvotes: 1