2

我的项目 100% 在 IOS 6.1 上工作,但随着我的改变,我遇到了以下问题

clang: warning: argument unused during compilation: '-stdlib'
Undefined symbols for architecture armv7:
  "std::cerr", referenced from:
      ImageCodec::unregisterCodec(ImageCodec*) in ocrkit-bin.o
      colorspace_convert(Image&, int, int, unsigned char) in ocrkit-bin.o
      colorspace_by_name(Image&, std::string const&, unsigned char) in ocrkit-bin.o
      flipX(Image&) in ocrkit-bin.o
      rot90(Image&, int) in ocrkit-bin.o
      exif_rotate(Image&, unsigned int) in ocrkit-bin.o
      BMPCodec::writeImage(std::ostream*, Image&, int, std::string const&) in ocrkit-bin.o
      ...
  "std::string::operator+=(std::string const&)", referenced from:
      Args::str() in ocrkit-bin.o
  "std::__throw_length_error(char const*)", referenced from:
      std::vector<PDFObject*, std::allocator<PDFObject*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<PDFObject**, std::vector<PDFObject*, std::allocator<PDFObject*> > >, PDFObject* const&) in ocrkit-bin.o
      std::vector<unsigned char, std::allocator<unsigned char> >::_M_fill_insert(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned long, unsigned char const&) in ocrkit-bin.o
      std::vector<unsigned char, std::allocator<unsigned char> >::_M_insert_aux(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char const&) in ocrkit-bin.o
      l4495 in ocrkit-bin.o
      l4497 in ocrkit-bin.o
      l4499 in ocrkit-bin.o
      l4501 in ocrkit-bin.o
      ...
  "std::string::clear()", referenced from:
      PDFContentStream::writeStreamImpl(std::ostream&) in ocrkit-bin.o
  "std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)", referenced from:
      PDFXObject::writeStreamImpl(std::ostream&) in ocrkit-bin.o
      PDFContentStream::writeStreamImpl(std::ostream&) in ocrkit-bin.o
  "std::ostream::operator<<(double)", referenced from:
      quantize::quantize(double, int) in ocrkit-bin.o
  "std::ostream::operator<<(unsigned long long)", referenced from:
      PDFNumber::writeImpl(std::ostream&) in ocrkit-bin.o
      PDFTrailer::write(std::ostream&) in ocrkit-bin.o
  "std::_List_node_base::hook(std::_List_node_base*)", referenced from:
      std::list<ImageCodec::loader_ref, std::allocator<ImageCodec::loader_ref> >::_M_insert(std::_List_iterator<ImageCodec::loader_ref>, ImageCodec::loader_ref const&) in ocrkit-bin.o
      std::list<PDFObject*, std::allocator<PDFObject*> >::_M_insert(std::_List_iterator<PDFObject*>, PDFObject* const&) in ocrkit-bin.o
      std::list<PDFXObject*, std::allocator<PDFXObject*> >::_M_insert(std::_List_iterator<PDFXObject*>, PDFXObject* const&) in ocrkit-bin.o
      std::list<PDFPage*, std::allocator<PDFPage*> >::_M_insert(std::_List_iterator<PDFPage*>, PDFPage* const&) in ocrkit-bin.o
  "std::basic_ofstream<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)", referenced from:
      PrintLines(void*, char const*) in ocrkit-bin.o
  "std::string::operator[](unsigned long)", referenced from:
      PNG2Codec::readImage(std::istream*, Image&, std::string const&) in ocrkit-bin.o
      quantize::quantize(double, int) in ocrkit-bin.o
  "std::basic_ios<char, std::char_traits<char> >::fill(char)", referenced from:
      PDFXref::write(std::ostream&) in ocrkit-bin.o
  "std::string::operator=(std::string const&)", referenced from:
      quantize::quantize(double, int) in ocrkit-bin.o
      PDFXObject::writeStreamTagsImpl(std::ostream&) in ocrkit-bin.o
      Args::str() in ocrkit-bin.o
  "std::ostream::tellp()", referenced from:
      PDFXref::write(std::ostream&) in ocrkit-bin.o
      PDFStream::writeImpl(std::ostream&) in ocrkit-bin.o
      PDFObject::write(std::ostream&) in ocrkit-bin.o
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)", referenced from:
      PDFXref::write(std::ostream&) in ocrkit-bin.o
      PNG2Codec::readImage(std::istream*, Image&, std::string const&) in ocrkit-bin.o
  "std::_Rb_tree_increment(std::_Rb_tree_node_base const*)", referenced from:
      PDFPage::writeImpl(std::ostream&) in ocrkit-bin.o
      Args::str() in ocrkit-bin.o
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, unsigned char)", referenced from:
      l022 in ocrkit-bin.o
  "std::string::append(char const*)", referenced from:
      _ocrForImage in ocrkit-bin.o

我已经使用这些 -ObjC -lxml2 -all_load -lstdc++ 所有链接器标志及其 100% 在 IOS 6.1 上工作 IOS 7.0 编译器有什么问题

4

2 回答 2

4

有可能你的项目使用了一些其他的框架或者嵌入式项目,已经用 gcc 编译过,并且你的项目切换到 7.0 已经开始使用 llvm 构建了。

您可以强制项目使用目标构建设置的 Apple LLVM 5.0 - C++ 部分中的 gcc 标准库

LLVM C++ 选项

于 2013-11-07T11:27:25.200 回答
1

错误表明未链接 C++ 标准库,我认为llvm您需要通过

-stdlib=libc++

而不是

-lstdc++

(由 gcc 使用?)虽然不完全确定,但我自己并没有将 C++ 与 Objective C 混合使用。

您可能在 iOS7 之前使用了 GCC iso LLVM,因此编译器(可能是无意的)通过更新您的项目而改变。

于 2013-09-23T08:39:13.217 回答