无法链接到共享库
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
std::_Rb_Tree
可能是一棵红黑树,这很可能来自使用map
。 它应该是libstdc++
的一部分,除非您的库链接的libstdc++
版本与应用程序不同,从您目前所说的来看,这似乎不太可能。编辑:只是为了澄清一下,红黑树是
map
中的底层数据结构。hash_map
所做的只是在使用密钥之前对其进行哈希处理,而不是使用原始值。std::_Rb_Tree
might be a red-black tree, which would most likely be from usingmap
. It should be part oflibstdc++
, unless your library is linking against a different version oflibstdc++
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 thathash_map
does is hash the key before using it, rather than using the raw value.尝试
in the source file where you are using map.
Try
in the source file where you are using map.
您似乎有来自不同版本的 gcc 的 2 个不同的不兼容版本的 libstdc++.so 。 检查你的路径。
You seem to have 2 different incompatible versions of libstdc++.so from different versions of gcc. Check your paths.