我试图交叉编译Tilera的源代码,但在链接时得到以下错误。所有这些错误都与C++标准模板库有关。
STL库的链接过程有什么区别吗?
错误包括:
gtpu_t. a: In function `stlp_std::_Atomic_swap_struct<0>::_S_swap(unsigned int volatile* , unsigned int)':
91 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :588: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock'
92 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :588: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock'
93 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :591: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock'
94 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :591: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock'
95 /u/TILERA/LTESTACK/TILERA/DEV/lte/lte_enb/enb_app/../enb_gtpu/gtpu_t/lib/gtpu_t. a: In function `stlp_std::_Atomic_swap_struct<0>::_S_swap_ptr(void* volatile*, v oid*)':
96 /u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads.h :614: undefined reference to `stlp_std::_Atomic_swap_struct<0>::_S_swap_lock'
97 /u/TILERA/LTESTACK/TILERA/DEV/lte/lte_enb/enb_app/../enb_gtpu/gtpu_t/lib/gtpu_t. a:/u/TILERA/TileraMDE-2.1.1.107611/tilepro/tile/usr/include/cpp/stl/stl/_threads .h:614: more undefined references to `stlp_std::_Atomic_swap_struct<0>::_S_swap_ lock' follow 发布于 2011-03-16 02:25:51
我想这会有帮助的。我以前试过用Tilera编译,得到类似的错误,“未定义的引用到”。解决方案是将库包含在项目属性中。
单击您的项目设置,转到路径和符号,并在库下包含定义stlp_std::_Atomic_swap_struct<0>::_S_swap_lock的库。
还要注意的是,Tilera IDE (eclipse)是愚蠢的。定义Tile库的路径将不起作用!只需输入库的名称即可。(假设您正确设置了IDE变量)。如果使用命令行,只需添加参数即可包含该库
-lMyLibrary
下面是一个示例:
在库下面有:
tmc
pthread我假设您是在Linux下开发的。
发布于 2010-11-17 17:39:46
"STL“只是C++实现的一部分。它不应该被特别链接,就像你不需要特别链接malloc或new一样。
发布于 2010-11-17 22:15:10
如果我编译一个使用的小程序,它使用_S_swap_lock,它对我来说是有效的:
$ cat foo.cc
#include <rope>
int main(void)
{
std::crope r(100000, 'x');
std::crope r2 = r + "abc";
}
$ tile-c++ foo.cc
$ nm -C a.out | grep -i atomic
0000000000059028 V stlp_std::_Atomic_swap_struct<1>::_S_swap_lock这是32位原子的"<1>“风格,似乎很常用。我在libsupc++.a中看不到<0>的味道。我怀疑你需要发布一些重现问题的代码。
https://stackoverflow.com/questions/4202769
复制相似问题