我正在开发QT中的应用程序,基于几个现有工具的组合,例如:ITK,VTK,DCMTK和SoQT(以及其他......)。
我正在尝试编译这整个混乱,经过几次尝试,我忍不住得到这个错误:
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
关于我正在使用的软件版本,它们是: ITK:4.3.1 VTK:5.10.1 SoQT:1.5.1 DCMTK:3.6.1(2012-11-02处的快照)
到目前为止,我认为错误与库VTK库的动态和静态链接有关,因为程序正在寻找的所有文件都已存在!
任何解决我问题的方法都会受到欢迎!!
提前致谢!
答案 0 :(得分:0)
看起来你没有链接到像vtkIO这样的一些vtk库。在CMake中,您可以通过向正在编译的应用程序的TARGET_LINK_LIBRARIES()添加$ {VTK_LIBRARIES}来避免指定每个vtk库。