【发布时间】:2014-10-25 02:51:26
【问题描述】:
例如这段代码:
#include <vector>
template<typename T>
void useVector(T);
using thing = std::vector<int>;
int main()
{
std::vector<thing> vec;
useVector(vec);
return 0;
}
产生过于冗长的消息:
/home/martin/Projects/TestGrounds/main.cpp:11: error: undefined reference to
`void useVector<std::vector<std::vector<int, std::allocator<int> >,
std::allocator<std::vector<int, std::allocator<int> > > >
>(std::vector<std::vector<int, std::allocator<int> >,
std::allocator<std::vector<int, std::allocator<int> > > >)'
有没有办法阻止编译器替换所有类型定义和默认参数并产生类似的东西:
/home/martin/Projects/TestGrounds/main.cpp:11: error: undefined reference to
void useVector(std::vector<thing>);
?
【问题讨论】:
-
试试 STLFilt [bdsoft.com/tools/stlfilt.html] 或 gccfilter [mixtion.org/gccfilter/]。 (有一段时间没有使用过,所以不确定它们处于什么状态,因此这是一条评论)。
-
此错误消息来自链接器,而不是编译器。这使得它更加更加困难。
标签: c++ gcc compiler-errors