0

I'm working in the development of an application in QT, based on the combination of several already existing tools such as: ITK, VTK, DCMTK and SoQT (among others...).

I'm trying to compile this whole mess and after several attempts, I can't help but obtaining this error:


Undefined symbols for architecture x86_64:
  "vtkPolyDataReader::New()", referenced from:
      ModelBuildingControl::extractProfileModels(unsigned int)in ModelBuildingControl.cpp.o
      ModelBuildingControl::loadModel()      in ModelBuildingControl.cpp.o
      vtkPolydata2Points::vtkPolydata2Points()in vtkPolydata2Points.cpp.o
      vtkPolydata2Points::vtkPolydata2Points()in vtkPolydata2Points.cpp.o
  "vtkPolyDataReader::GetOutput()", referenced from:
      ModelBuildingControl::extractProfileModels(unsigned int)in ModelBuildingControl.cpp.o
      vtkPolydata2Points::readSurfaceFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in vtkPolydata2Points.cpp.o
  "vtkPolyDataReader::SetOutput(vtkPolyData*)", referenced from:
      ModelBuildingControl::loadModel()      in ModelBuildingControl.cpp.o
  "vtkStructuredPointsReader::New()", referenced from:
      ModelBuildingControl::transformVolume()       in ModelBuildingControl.cpp.o
      ModelBuildingControl::transformAtlasInNaturalCOS(QString, QString) in ModelBuildingControl.cpp.o
      ModelBuildingControl::landmarkDist()       in ModelBuildingControl.cpp.o
  "vtkStructuredPointsReader::GetOutput()", referenced from:
      ModelBuildingControl::transformVolume()       in ModelBuildingControl.cpp.o
      ModelBuildingControl::transformAtlasInNaturalCOS(QString, QString) in ModelBuildingControl.cpp.o
  "vtkStructuredPointsWriter::New()", referenced from:
      ModelBuildingControl::transformVolume()       in ModelBuildingControl.cpp.o
      ModelBuildingControl::transformAtlasInNaturalCOS(QString, QString) in ModelBuildingControl.cpp.o
      ModelBuildingControl::buildAtlas()       in ModelBuildingControl.cpp.o
      ModelBuildingControl::exportPatientVolumes()       in ModelBuildingControl.cpp.o
  "vtkWriter::SetInput(vtkDataObject*)", referenced from:
      ModelBuildingControl::transformVolume()       in ModelBuildingControl.cpp.o
      ModelBuildingControl::transformAtlasInNaturalCOS(QString, QString) in ModelBuildingControl.cpp.o
      ModelBuildingControl::warpLensAtlasIntoPatients(std::basic_ofstream<char, std::char_traits<char> >&, vtkPolyData*, QString)in ModelBuildingControl.cpp.o
      ModelBuildingControl::warpScleraAtlasIntoPatients(std::basic_ofstream<char, std::char_traits<char> >&, vtkPolyData*, QString)in ModelBuildingControl.cpp.o
      ModelBuildingControl::landmarkDist()       in ModelBuildingControl.cpp.o
      ModelBuildingControl::buildAtlas()       in ModelBuildingControl.cpp.o
      ModelBuildingControl::exportPatientVolumes()       in ModelBuildingControl.cpp.o
      ...
  "vtkPolyDataWriter::New()", referenced from:
      ModelBuildingControl::warpLensAtlasIntoPatients(std::basic_ofstream<char, std::char_traits<char> >&, vtkPolyData*, QString)in ModelBuildingControl.cpp.o
      ModelBuildingControl::warpScleraAtlasIntoPatients(std::basic_ofstream<char, std::char_traits<char> >&, vtkPolyData*, QString)in ModelBuildingControl.cpp.o
      ModelBuildingControl::landmarkDist()       in ModelBuildingControl.cpp.o
      Points2vtkPolydata::Points2vtkPolydata()in Points2vtkPolydata.cpp.o
      Points2vtkPolydata::Points2vtkPolydata()in Points2vtkPolydata.cpp.o
  "vtkStructuredPointsReader::SetOutput(vtkStructuredPoints*)", referenced from:
      ModelBuildingControl::landmarkDist()       in ModelBuildingControl.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

Regarding the versions of the software I'm using, they are: ITK: 4.3.1 VTK: 5.10.1 SoQT: 1.5.1 DCMTK: 3.6.1 (snapshot at 2012-11-02)

So far, I think the error has something to do with the dynamic and static linking of the libraries VTK libraries, as all the files the program is looking for are already there!

Any light you may shed into solving my problem will be more than welcome!!

Thanks in advance!

Ciller
  • 13
  • 6
  • It looks like you are not linking to a few vtk libs like vtkIO. Does the project use CMake to generate the project files? If so make sure ${VTK_LIBRARIES} is in your target_link_libraries() for the application your are compiling. – drescherjm Feb 11 '13 at 14:42
  • @drescherjm: Finally I realized that there was a missing library in the CMake list: `set( EXT_LIBRARIES ${EXT_LIBRARIES} vtkCommon vtkGraphics vtkFiltering vtkImaging **vtkIO**)`, that drove me into a bigger error, but I was able to solve it as well. The suggestion you made resulted in the final compilation of the application. Thanks a lot for your help!!! :D – Ciller Feb 12 '13 at 14:28
  • Posted as answer so we can call this solved. – drescherjm Feb 12 '13 at 18:19

1 Answers1

0

It looks like you are not linking to a few vtk libs like vtkIO. In CMake you can avoid having to specify each vtk lib by adding ${VTK_LIBRARIES} to your TARGET_LINK_LIBRARIES() for the application you are compiling.

drescherjm
  • 10,365
  • 5
  • 44
  • 64
  • I'm having the same problem, but I did not get what you mean by your answer. I have a CMakeCache.txt and a CMakeLists.txt and both of them do not have TARGET_LINK_LIBRARIES – Lily Jul 21 '15 at 15:17
  • In the CMakeLists.txt that you wrote for your application you need to use ${VTK_LIBRARIES} in your TARGET_LINK_LIBRARIES(). If you do not have a TARGET_LINK_LIBRARIES() you need to add one. Or did you use some ide that generated a CMakeLists.txt for you. I manually create my CMakeLists.txt and primarily use it with several versions of Visual Studio on windows. – drescherjm Jul 21 '15 at 15:30