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”。

  • 相关阅读:
    灵活使用ssh、dsh和pssh高效管理大量计算机
    GDPR全文翻译(二)
    GDPR全文翻译(一)
    加盐密码哈希:如何正确使用
    p2p通信原理及实现
    拜耳阵列
    数码相机成像原理
    图像基础
    antd Tree组件中,自定义右键菜单
    如何保障前端项目的代码质量
  • 原文地址:https://www.cnblogs.com/jaenson/p/3892384.html
Copyright © 2011-2022 走看看