无法链接到共享库

发布于 2024-07-05 12:25:02 字数 653 浏览 7 评论 0原文

我正在使用 g++ 3.3.4 构建一个共享库。 我无法链接到该库,因为我得到了

./BcdFile.RHEL70.so: undefined symbol: _ZNSt8_Rb_treeIjjSt9_IdentityIjESt4lessIjESaIjEE13insert_uniqueERKj

Which c++filt 描述的内容,因为

std::_Rb_tree<unsigned int, unsigned int, std::_Identity<unsigned int>, std::less<unsigned int>, std::allocator<unsigned int> >::insert_unique(unsigned int const&)

我认为这可能来自使用 hash_map,但我已将其全部取出并切换到常规 std::map。 我使用 g++ 进行链接,其中包括 -lstdc++

有谁知道哪个类会实例化这个模板? 或者更好的是,我需要链接到哪个库?

编辑:经过进一步审查,似乎在编译时添加 -frepo 标志导致了此问题,不幸的是该标志正在解决 gcc3.3 错误。

I'm building a shared library with g++ 3.3.4. I cannot link to the library because I am getting

./BcdFile.RHEL70.so: undefined symbol: _ZNSt8_Rb_treeIjjSt9_IdentityIjESt4lessIjESaIjEE13insert_uniqueERKj

Which c++filt describes as

std::_Rb_tree<unsigned int, unsigned int, std::_Identity<unsigned int>, std::less<unsigned int>, std::allocator<unsigned int> >::insert_unique(unsigned int const&)

I thought this might have come from using hash_map, but I've taken that all out and switched to regular std::map. I am using g++ to do the linking, which is including -lstdc++.

Does anyone know what class would be instantiating this template? Or even better, which library I need to be linking to?

EDIT: After further review, it appears adding the -frepo flag when compiling has caused this, unfortunately that flag is working around gcc3.3 bug.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

这个俗人 2024-07-12 12:25:02

std::_Rb_Tree 可能是一棵红黑树,这很可能来自使用 map。 它应该是 libstdc++ 的一部分,除非您的库链接的 libstdc++ 版本与应用程序不同,从您目前所说的来看,这似乎不太可能。

编辑:只是为了澄清一下,红黑树是 map 中的底层数据结构。 hash_map 所做的只是在使用密钥之前对其进行哈希处理,而不是使用原始值。

std::_Rb_Tree might be a red-black tree, which would most likely be from using map. It should be part of libstdc++, unless your library is linking against a different version of libstdc++ than the application, which from what you've said so far seems unlikely.

EDIT: Just to clarify, the red-black tree is the underlying data structure in map. All that hash_map does is hash the key before using it, rather than using the raw value.

小伙你站住 2024-07-12 12:25:02

尝试

#include < map > 

in the source file where you are using map.

Try

#include < map > 

in the source file where you are using map.

夏末染殇 2024-07-12 12:25:02

您似乎有来自不同版本的 gcc 的 2 个不同的不兼容版本的 libstdc++.so 。 检查你的路径。

You seem to have 2 different incompatible versions of libstdc++.so from different versions of gcc. Check your paths.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文