0

I'm trying to update an older (iOS4,5 era) app to iOS7 and am getting some compile/linker issues I can't figure out.

I'm not sure the solution to the small subset of the compile errors pasted below.

These issues appear to be from my usage of ScannerKit. I was on version 4.2.1 and tried to update to the latest 4.3.0 but the issues remain. I defined have libScannerKit.a in my "Link Binary with Libraries" build phase.

Undefined symbols for architecture i386:
  "std::string::find(char, unsigned long) const", referenced from:
      zxing::oned::Code39Reader::decodeRow(int, zxing::Ref<zxing::BitArray>) in libScannerKit.a(Code39Reader.o)
  "std::string::substr(unsigned long, unsigned long) const", referenced from:
      zxing::oned::ConfigurableMultiFormatUPCEANReader::decodeRow(int, zxing::Ref<zxing::BitArray>) in libScannerKit.a(ConfigurableMultiFormatUPCEANReader.o)
      zxing::oned::MultiFormatUPCEANReader::decodeRow(int, zxing::Ref<zxing::BitArray>) in libScannerKit.a(MultiFormatUPCEANReader.o)
      zxing::oned::UPCAReader::maybeReturnResult(zxing::Ref<zxing::Result>) in libScannerKit.a(UPCAReader.o)
      zxing::oned::UPCEReader::convertUPCEtoUPCA(std::string) in libScannerKit.a(UPCEReader.o)
  "std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const", referenced from:
      zxing::BitMatrix::description() in libScannerKit.a(BitMatrix.o)
      zxing::GridSampler::checkAndNudgePoints(zxing::Ref<zxing::BitMatrix>, std::vector<float, std::allocator<float> >&) in libScannerKit.a(GridSampler.o)
      zxing::GF256Poly::description() const in libScannerKit.a(GF256Poly.o)
      zxing::datamatrix::DecodedBitStreamParser::decode(zxing::ArrayRef<unsigned char>) in libScannerKit.a(DecodedBitStreamParser-E74816B4CEA9EA3A.o)
      zxing::oned::Code128Reader::decodeRow(int, zxing::Ref<zxing::BitArray>) in libScannerKit.a(Code128Reader.o)
          zxing::qrcode::DecodedBitStreamParser::decodeByteSegment(zxing::Ref<zxing::BitSource>, std::string&, int) in libScannerKit.a(DecodedBitStreamParser-B6EF2F7091225D41.o)
      zxing::qrcode::DecodedBitStreamParser::decodeNumericSegment(zxing::Ref<zxing::BitSource>, std::string&, int) in libScannerKit.a(DecodedBitStreamParser-B6EF2F7091225D41.o)
  ...
  "std::ostream::flush()", referenced from:
      zxing::datamatrix::DataMatrixReader::decode(zxing::Ref<zxing::BinaryBitmap>) in libScannerKit.a(DataMatrixReader.o)

I'm trying to just update the app and make this newest release iOS7+ only. This project is old and it was original created in the early versions of XCode 4 so I dont know if there is some kind of vestigial config file issues or something. Or is this something where ScannerKit is built against i386 and I'm not including that arch in my build or something?

If anyone is interested, here is a full gist of the compile errors

cpjolicoeur
  • 12,766
  • 7
  • 48
  • 59

3 Answers3

0

It seems like you're not linking to libstdc++. Add that to your project "Linked frameworks and Libraries" and it should fix your linker errors.

Ivan Genchev
  • 2,746
  • 14
  • 25
  • No, I thought of that as well and already had added `libstd++`. That didnt change anything – cpjolicoeur Nov 29 '13 at 17:35
  • You can also try adding -lstdc++ to "Other liker flags" and check if you already have -stdlib=libc++ passed to the liker in the build output, otherwise it sounds very strange to have these liker errors if you are already linking to libstdc++... – Ivan Genchev Nov 29 '13 at 17:43
  • Also check out this answer: http://stackoverflow.com/questions/3452203/how-do-i-resolve-link-errors-that-appear-in-objective-c-but-not-objective-c it suggests that it might be because of method mangling in C++. And this one as well: http://stackoverflow.com/questions/19364416/apple-mach-o-linker-error-with-upnpx-library since you're updating an old project, your compiler settings may be messed up.. – Ivan Genchev Dec 02 '13 at 10:31
0

i386 is the architecture for the simulator. It could possibly be that they did not compile the library to run on the simulator architecture. Try loading it on an iPhone and see if it compiles and runs. If it does then the issue is simply that they did not install a simulator architecture, and you can proceed just with slightly more annoyance.

You can also use the file command in the terminal to see what architectures it supports.

AdamG
  • 3,718
  • 2
  • 18
  • 28
0

I think your base SDK is still configured wrong, check under project settings > Build Settings "Base SDK" and "Architectures" (they already are at top of the list). You could also try iOS6 Simulator, and see if error still persist.

Jeremiah Smith
  • 740
  • 6
  • 17