简体   繁体   English

无法链接到共享库

[英]Unable to link to shared library

I'm building a shared library with g++ 3.3.4. 我正在使用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 哪个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&)

I thought this might have come from using hash_map, but I've taken that all out and switched to regular std::map. 我以为这可能来自使用hash_map,但我已将所有内容全部删除并切换到常规std :: map。 I am using g++ to do the linking, which is including -lstdc++ . 我正在使用g ++进行链接,其中包括-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. 编辑:经过进一步审查,似乎在编译时导致添加-frepo标志,这很不幸,该标志正在解决gcc3.3错误。

std::_Rb_Tree might be a red-black tree, which would most likely be from using map . std::_Rb_Tree可能是一棵红黑树,很可能来自使用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. 它应该是libstdc++一部分,除非您的库所链接的libstdc++版本与该应用程序的版本不同,就您到目前为止所说的看来,这似乎不太可能。

EDIT: Just to clarify, the red-black tree is the underlying data structure in map . 编辑:只是为了澄清,红黑树是map的基础数据结构。 All that hash_map does is hash the key before using it, rather than using the raw value. hash_map所做的只是在使用键之前对其进行哈希处理,而不是使用原始值。

Try 尝试

#include < map > 
in the source file where you are using map. 在您使用地图的源文件中。

You seem to have 2 different incompatible versions of libstdc++.so from different versions of gcc. 您似乎有来自gcc不同版本的2个不兼容的libstdc ++。so版本。 Check your paths. 检查您的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM