在mavericks osx 10.9上的VTK编译错误

时间:2015-07-25 15:57:55

标签: c++ compiler-errors linker osx-mavericks vtk

我使用以下步骤

成功地在我的mac上安装了VTK

How to install VTK 6.1 for OSX 10.8 with Cocoa/XCode support?

我试图使用VTK,而且我得到了很长的错误列表,我不确定它是否与VTK或gcc有关? 这是我得到的错误的一部分 有一些类似于此

的错误
Undefined symbols for architecture x86_64:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::find_last_of(char const*, unsigned long, unsigned long) const", referenced from:
  vtksys::SystemTools::GetFilenameName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libvtksys-6.1.a(SystemTools.cxx.o)


"std::__1::__vector_base_common<true>::__throw_out_of_range() const", referenced from:
  std::__1::vector<vtkStdString*, std::__1::allocator<vtkStdString*> >::at(unsigned long) in libvtkCommonCore-6.1.a(vtkAbstractArray.cxx.o)
  std::__1::vector<std::__1::pair<bool, vtkStdString>, std::__1::allocator<std::__1::pair<bool, vtkStdString> > >::at(unsigned long) in libvtkCommonDataModel-6.1.a(vtkDataSetAttributes.cxx.o)
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
  __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES9_S9_ in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)

  ...
"std::__1::locale::has_facet(std::__1::locale::id&) const", referenced from:
  std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in libvtkIOImage-6.1.a(vtkImageWriter.cxx.o)
  std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in libvtksys-6.1.a(SystemTools.cxx.o)
  std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in libvtkCommonSystem-6.1.a(vtkTimerLog.cxx.o)
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonCore-6.1.a(vtkOutputWindow.cxx.o)
  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libvtkCommonCore-6.1.a(vtkOutputWindow.cxx.o)
  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonDataModel-6.1.a(vtkImageData.cxx.o)

  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libvtkCommonCore-6.1.a(vtkOStreamWrapper.cxx.o)
  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonCore-6.1.a(vtkOStreamWrapper.cxx.o)
"std::__1::ios_base::getloc() const", referenced from:
  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonCore-6.1.a(vtkOutputWindow.cxx.o)
  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libvtkCommonCore-6.1.a(vtkOutputWindow.cxx.o)
  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonDataModel-6.1.a(vtkImageData.cxx.o)
  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkIOImage-6.1.a(vtkPNGWriter.cxx.o)
  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in libvtkCommonCore-6.1.a(vtkOStreamWrapper.cxx.o)
  std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in libvtkCommonCore-6.1.a(vtkOStreamWrapper.cxx.o)
  ...
 "std::logic_error::logic_error(char const*)", referenced from:
  vtkUnicodeString::at(unsigned long) const in libvtkCommonCore-6.1.a(vtkUnicodeString.cxx.o)

和一些与此类似的错误

"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
  std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char) in libvtksys-6.1.a(SystemTools.cxx.o)
  std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libvtksys-6.1.a(SystemTools.cxx.o)

"std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
  char vtkVariantStringToNumeric<char>(vtkStdString, bool*, char*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
  float vtkVariantStringToNumeric<float>(vtkStdString, bool*, float*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
  double vtkVariantStringToNumeric<double>(vtkStdString, bool*, double*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
  unsigned char vtkVariantStringToNumeric<unsigned char>(vtkStdString, bool*, unsigned char*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
  signed char vtkVariantStringToNumeric<signed char>(vtkStdString, bool*, signed char*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
  short vtkVariantStringToNumeric<short>(vtkStdString, bool*, short*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
  unsigned short vtkVariantStringToNumeric<unsigned short>(vtkStdString, bool*, unsigned short*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)

"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::sync()", referenced from:
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonExecutionModel-6.1.a(vtkExecutive.cxx.o)
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkGarbageCollector.cxx.o)
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtksys-6.1.a(SystemTools.cxx.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::imbue(std::__1::locale const&)", referenced from:
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonExecutionModel-6.1.a(vtkExecutive.cxx.o)
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkGarbageCollector.cxx.o)
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtksys-6.1.a(SystemTools.cxx.o)
"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::uflow()", referenced from:
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)
  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonExecutionModel-6.1.a(vtkExecutive.cxx.o)
  vtable for std::__1::basic_filebuf<char, std::__1::char_traits<char> > in libvtkIOImage-6.1.a(vtkImageWriter.cxx.o)

  vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkGarbageCollector.cxx.o)


"std::__1::basic_streambuf<char, std::__1::char_traits<char> >::basic_streambuf()", referenced from:
  vtkOStrStreamWrapper::vtkOStrStreamWrapper() in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)
  vtkExecutive::CheckAlgorithm(char const*, vtkInformation*) in libvtkCommonExecutionModel-6.1.a(vtkExecutive.cxx.o)
  std::__1::basic_filebuf<char, std::__1::char_traits<char> >::basic_filebuf() in libvtkIOImage-6.1.a(vtkImageWriter.cxx.o)
  vtkGarbageCollectorImpl::PrintComponent(vtkGarbageCollectorImpl::ComponentType*) in libvtkCommonCore-6.1.a(vtkGarbageCollector.cxx.o)
  vtkGarbageCollectorImpl::Report(vtkObjectBase*, void*, char const*) in libvtkCommonCore-6.1.a(vtkGarbageCollector.cxx.o)
  vtkVariant::ToString() const in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
  vtkStdString vtkVariantArrayToString<vtkArrayIteratorTemplate<double> >(vtkArrayIteratorTemplate<double>*) in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)

"std::__1::cout", referenced from:
  vtkPolyhedron::vtkInternal::ExtractContourConnectivities(vtkIdToIdVectorMapType&, std::__1::set<long long, std::__1::less<long long>, std::__1::allocator<long long> >&, std::__1::vector<long long, std::__1::allocator<long long> >&, vtkIdToIdVectorMapType&, vtkIdToIdVectorMapType&, vtkIdToIdVectorMapType&) in libvtkCommonDataModel-6.1.a(vtkPolyhedron.cxx.o)

"void std::__1::__sort<std::__1::__less<signed char, signed char>&, signed char*>(signed char*, signed char*, std::__1::__less<signed char, signed char>&)", referenced from:
  vtkSortDataArray::Sort(vtkAbstractArray*)       in libvtkCommonCore-6.1.a(vtkSortDataArray.cxx.o)


 "typeinfo for std::__1::basic_istream<char, std::__1::char_traits<char> >", referenced from:
  construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_istringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkVariant.cxx.o)
>::~basic_ostream()", referenced from:
  construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libvtkCommonCore-6.1.a(vtkOStrStreamWrapper.cxx.o)

  construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_ofstream<char, std::__1::char_traits<char> > in libvtksys-6.1.a(SystemTools.cxx.o)
  ...
"_crc32", referenced from:
  _vtk_png_reset_crc in libvtkpng-6.1.a(png.c.o)
  _vtk_png_calculate_crc in libvtkpng-6.1.a(png.c.o)
"_deflate", referenced from:
  _vtk_png_write_flush in libvtkpng-6.1.a(pngwrite.c.o)
  _png_text_compress in libvtkpng-6.1.a(pngwutil.c.o)
  _vtk_png_write_finish_row in libvtkpng-6.1.a(pngwutil.c.o)
  _vtk_png_write_filtered_row in libvtkpng-6.1.a(pngwutil.c.o)
"_deflateEnd", referenced from:
  _vtk_png_write_destroy in libvtkpng-6.1.a(pngwrite.c.o)
 "_deflateInit2_", referenced from:
  _vtk_png_write_IHDR in libvtkpng-6.1.a(pngwutil.c.o)
"_deflateReset", referenced from:
  _png_write_compressed_data_out in libvtkpng-6.1.a(pngwutil.c.o)
  _vtk_png_write_finish_row in libvtkpng-6.1.a(pngwutil.c.o)
"_inflateReset", referenced from:
  _vtk_png_reset_zstream in libvtkpng-6.1.a(png.c.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [myCode] Error 1

任何提示都会有所帮助

1 个答案:

答案 0 :(得分:1)

事实证明我必须添加以下两个库-lc++ -lz。我在以下两个链接中找到了答案: