zoukankan      html  css  js  c++  java
  • iOS开发引入第三方类库的问题

    在开发iOS程序的过程中,通常在导入第三方的类库(.a/.o)文件会报出一系列的错误:

    Undefined symbols for architecture i386:
      "std::string::c_str() const", referenced from:
          MP4Chunk::putTag(std::string) in libHKSUMEyeSDK.a(MP4Chunk.o)
      "std::string::empty() const", referenced from:
          MP4Chunk::putTag(std::string) in libHKSUMEyeSDK.a(MP4Chunk.o)
      "std::allocator<char>::allocator()", referenced from:
          MP4Chunk::writeFtypTag() in libHKSUMEyeSDK.a(MP4Chunk.o)
          MP4Chunk::writeFreeTag() in libHKSUMEyeSDK.a(MP4Chunk.o)
          MP4Chunk::writeMdatTag() in libHKSUMEyeSDK.a(MP4Chunk.o)
          MP4Chunk::writeMoovTag() in libHKSUMEyeSDK.a(MP4Chunk.o)
          MP4Chunk::writeMvhdTag() in libHKSUMEyeSDK.a(MP4Chunk.o)
          MP4Chunk::WriteIODS() in libHKSUMEyeSDK.a(MP4Chunk.o)
          MP4Chunk::writeTrakTag() in libHKSUMEyeSDK.a(MP4Chunk.o)
    

     看似缺少了某个类库文件,但多次检查之后发现,没缺少啥引用的,甚至跟原来的Demo一个都不差,这是怎么回事?

    由于第三方类库多数是用C++或者C编写的,在引用过程中,还需要告诉编译器可能会出现的语言种类,以便使用对应的解释器进行解析。

    OK,那么我们只需要在XCode环境中检查以下几个配置项是否与下面一致即可:

    TARGETS->Build Settings,搜索

    1.Other Linker Flags:-ObjC

    2.C++ Language Dialect:Compiler Default

    3.C++ Standard Library:Compiler Default

    4.Compile Sources As:Objective-C++或者设置为According to File Type,然后将引用到C++类库的文件后缀改为“.mm”。

  • 相关阅读:
    洛谷P3819 松江1843路
    洛谷P1896 [SCOI2005]互不侵犯King
    洛谷P1197 [JSOI2008]星球大战
    洛谷P1171 售货员的难题
    2017-10-24 NOIP模拟赛
    LibreOJ #6192. 「美团 CodeM 复赛」城市网络
    洛谷P2258 子矩阵
    Cogs 9. 中心台站建设
    Cogs 6. 线型网络
    洛谷P3138 [USACO16FEB]负载平衡Load Balancing_Silver
  • 原文地址:https://www.cnblogs.com/jaenson/p/3892384.html
Copyright © 2011-2022 走看看