- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在从事一个实现 OhNet 库的项目。它还为您提供了使用该项目的机会当我加入团队时就开始了,他们提供了已编译的库和实现。重做一些类并清除所有警告后,我得到的最后一个是“不推荐使用 libstdc++;移至 libc++ [-Wdeprecated]”。我希望通过更改为建议的选择警告会消失但是我得到了一堆编译错误
Undefined symbols for architecture arm64:
"std::_List_node_base::unhook()", referenced from:
OpenHome::Net::CpiSubscriptionManager::Run() in libohNetCore.a(CpiSubscription.o)
OpenHome::Net::DviSubscriptionManager::Run() in libohNetCore.a(DviSubscription.o)
OpenHome::Net::CpiDeviceListUpdater::~CpiDeviceListUpdater() in libohNetCore.a(CpiDevice.o)
OpenHome::Net::CpiDeviceListUpdater::Run() in libohNetCore.a(CpiDevice.o)
OpenHome::NetworkAdapterChangeNotifier::~NetworkAdapterChangeNotifier() in libohNetCore.a(NetworkAdapterList.o)
OpenHome::NetworkAdapterChangeNotifier::Run() in libohNetCore.a(NetworkAdapterList.o)
OpenHome::Net::XmlFetchManager::~XmlFetchManager() in libohNetCore.a(XmlFetcher.o)
...
"std::__throw_length_error(char const*)", referenced from:
std::vector<OpenHome::Net::Argument*, std::allocator<OpenHome::Net::Argument*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<OpenHome::Net::Argument**, std::vector<OpenHome::Net::Argument*, std::allocator<OpenHome::Net::Argument*> > >, OpenHome::Net::Argument* const&) in libohNetCore.a(CpiService.o)
std::vector<OpenHome::Net::DvAction, std::allocator<OpenHome::Net::DvAction> >::_M_insert_aux(__gnu_cxx::__normal_iterator<OpenHome::Net::DvAction*, std::vector<OpenHome::Net::DvAction, std::allocator<OpenHome::Net::DvAction> > >, OpenHome::Net::DvAction const&) in libohNetCore.a(DviService.o)
std::vector<OpenHome::Net::Property*, std::allocator<OpenHome::Net::Property*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<OpenHome::Net::Property**, std::vector<OpenHome::Net::Property*, std::allocator<OpenHome::Net::Property*> > >, OpenHome::Net::Property* const&) in libohNetCore.a(DviService.o)
std::vector<OpenHome::Net::DviSubscription*, std::allocator<OpenHome::Net::DviSubscription*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<OpenHome::Net::DviSubscription**, std::vector<OpenHome::Net::DviSubscription*, std::allocator<OpenHome::Net::DviSubscription*> > >, OpenHome::Net::DviSubscription* const&) in libohNetCore.a(DviService.o)
std::vector<OpenHome::Net::Parameter*, std::allocator<OpenHome::Net::Parameter*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<OpenHome::Net::Parameter**, std::vector<OpenHome::Net::Parameter*, std::allocator<OpenHome::Net::Parameter*> > >, OpenHome::Net::Parameter* const&) in libohNetCore.a(Service.o)
std::vector<OpenHome::MListener*, std::allocator<OpenHome::MListener*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<OpenHome::MListener**, std::vector<OpenHome::MListener*, std::allocator<OpenHome::MListener*> > >, OpenHome::MListener* const&) in libohNetCore.a(Env.o)
std::vector<OpenHome::ISuspendObserver*, std::allocator<OpenHome::ISuspendObserver*> >::_M_insert_aux(__gnu_cxx::__normal_iterator<OpenHome::ISuspendObserver**, std::vector<OpenHome::ISuspendObserver*, std::allocator<OpenHome::ISuspendObserver*> > >, OpenHome::ISuspendObserver* const&) in libohNetCore.a(Env.o)
我正在使用“libohNetCore.a”和“libohNetProxies.a”
为什么我会收到此错误?这种变化到底在做什么?
非常感谢。
最佳答案
当您更改为 C++
标准库的不同实现时,您不能使用已经编译的 .a
文件。
这些库似乎是使用 libstdc++
编译的,因此公开了仅适用于 libstdc++
的方法。您需要使用 libc++
编译的 libohNetCore.a
和 libohNetProxies.a
的拷贝,以便在您切换到 时让它们工作>libc++
.
我下载了OhNet
code from github .它被定义为支持 -miphoneos-version-min=2.2
,因此它将使用 libstdc++
进行编译,因为它将支持 iOS 2.2 和更新版本。
如果将最低目标 iOS 更改为 5.0
,则可以将 -stdlib=libc++
添加到编译行:
compiler = $(toolroot)/clang -stdlib=libc++
它将使用libc++
编译。
如果您将最低目标 iOS 更改为 7.0
,那么它将默认使用 libc++
进行编译,一旦您编译完成,您将拥有 libOhNetCore。 a
为 libc++
编译。
要检查 .a
是否为 libstdc++ 或 libc++ 编译,您需要在其上运行 nm 以查找,例如,std::string
$ nm ./Build/Obj/iOS-arm64/Release/libohNetCore.a | c++filt | grep std::string | head -1
0000000000000084 T OpenHome::Net::CpDeviceCpp::GetAttribute(char const*, std::string&) const
这是用 libstdc++
编译的 - std::string
的存在表明了这一点。
对于 libc++,模式略有不同:
$ nm ./Build/Obj/iOS-arm64/Release/libohNetCore.a | c++filt | grep string | head -1
0000000000000084 T OpenHome::Net::CpDeviceCpp::GetAttribute(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) const
即std::__1
的存在表明它是用 libc++
编译的。
关于c++ - libstdc++ 已弃用;移至 libc++ [-Wdeprecated] 但更改会产生编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46927007/
如果我选择这样做: gcc my.cpp -lstdc++ 它与 libstdc++.so 链接,对吗?但是代码中有一些 c/c++ 初始化部分(全局/静态变量/对象、atexit() 函数等),似乎
在尝试使用 __gcclibcxx_demangle_callback 作为 __cxa_demangle 的非分配替代方案时,我遇到了一个给我带来一些麻烦的问题。当我静态链接 libstdc++ 时
在使用比我的旧操作系统的目标机器上运行我的闭源应用程序时,我得到以下信息: ./myapp: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not f
我碰巧从头开始为一个开源项目(WebRTC AppRTCDemo)做了一个Xcode项目。我阅读了构建脚本文件 (.ninja) 并配置了 Xcode build设置,超过 10 个小时......我
我想以重要的通知作为开头,我不是 C/C++ 程序员,并且对库的链接如何在 C 中工作知之甚少。 我们的代码使用 libstdc++.so.6(我认为是 gcc 3.4)。我们有使用 libstdc+
一个简单的问题 - 有没有办法让 g++ 链接器与特定的 libstdc++ 库版本链接?我在 gcc/g++ 的手册页中没有找到任何有用的东西,在这里的其他问题中也没有。 这是这种情况 - 我的应用
我能够成功构建我的代码,但在尝试运行它时出现以下错误。我在 AIX7.1 上使用 GCC4.8.5。 0509-130 Symbol resolution failed for libadobelin
我正在尝试一些诡异的东西。我正在尝试编写 C++ 程序,用 GNU 的 g++ 编译,但不依赖于 libstdc++ :) 但似乎我需要它,即使是最基本的东西也需要它。 具有可配置功能集的 libst
我试图删除 ~/.eclipse 中的所有文件和临时文件并重新安装 eclipse+cdt。但是那些默认路径并没有再次出现。 我去了'c/c++ general'->'paths and symbol
我正在尝试构建一个具有 native 组件的旧 Android 项目。 当我尝试构建项目时出现以下错误: Task :app:externalNativeBuildDebug FAILED Build
我正在使用 Ubuntu 8.04/32 位(作为虚拟机)。在一个不是 min 的项目上执行一些 make 时,我得到了错误: g++:/usr/lib/libstdc++.a: 没有这样的文件或目录
--disable-hosted-libstdcxx only build freestanding C++ runtime support 来自
我无法通过 libstdc++(并行模式)的并行实现使用就地排序算法(快速排序和平衡快速排序;QS/BQS)获得高于 2 的加速比。我曾尝试在包含 16 到 24 个内核的许多不同系统上运行代码。我也
自升级到 xcode 10 beta 6 后我收到错误 ld: library not found for -lstdc++ clang: error: linker command failed w
这个问题在这里已经有了答案: Using `std::function` to call non-void function (3 个答案) 关闭 7 年前。 我正在编译一个简单的(也可能是错误的)
是否有表格指定新标准(11 和 14)对 以前 版本的 GNU libstdc++ 的支持? 我为 compiler 找到了这样的表格和 current lib state . 但是我如何确定 gcc
我试图让我的程序在另一台 libstdc++ 版本不同的机器上运行。我正在 netbeans 上开发和编译它。我已指定选项 -static-libstdc++ 但程序继续尝试在本地计算机中加载 lib
C++ 标准库的大部分组件均以源代码形式导出代码形式,即仅在头文件中提供。 C 库的大部分函数均由 libc.so 提供。 所以,我的问题是: 为什么我们需要 libstdc++.so? libstd
我正在使用 openGL 编写 C 应用程序。我所有的代码都符合 C99,而且我根本没有使用 C++。我的程序与 openGL 库和 SDL2 链接。 运行 ldd 我得到: linux-vdso.s
我在 MAC 上使用 libstdc++ 来开发 firefox 的扩展。当我跨多个 Firefox 扩展引用它时,我在 libstdc+ 库中遇到崩溃。我在想 XCode 编译器的 libstdc+
我是一名优秀的程序员,十分优秀!