无法链接到共享库

时间:2021-04-29 15:30:09

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

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

./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. I am using g++ to do the linking, which is including -lstdc++.

我认为这可能来自于使用hash_map,但我已经全力以赴并切换到常规std :: map。我使用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错误。

3 个解决方案

#1


1  

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.

std :: _ Rb_Tree可能是一棵红黑树,很可能是使用地图。它应该是libstdc ++的一部分,除非你的库链接到不同版本的libstdc ++而不是应用程序,这从你到目前为止所说的内容似乎不太可能。

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.

编辑:只是为了澄清,红黑树是地图中的基础数据结构。 hash_map所做的就是在使用它之前对键进行散列,而不是使用原始值。

#2


0  

Try

#include < map > 
in the source file where you are using map.

#3


0  

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

您似乎有两个不同的libstdc ++不兼容版本。所以从不同版本的gcc。检查你的路径。

#1


1  

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.

std :: _ Rb_Tree可能是一棵红黑树,很可能是使用地图。它应该是libstdc ++的一部分,除非你的库链接到不同版本的libstdc ++而不是应用程序,这从你到目前为止所说的内容似乎不太可能。

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.

编辑:只是为了澄清,红黑树是地图中的基础数据结构。 hash_map所做的就是在使用它之前对键进行散列,而不是使用原始值。

#2


0  

Try

#include < map > 
in the source file where you are using map.

#3


0  

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

您似乎有两个不同的libstdc ++不兼容版本。所以从不同版本的gcc。检查你的路径。