传递类型为std :: vector <structtype *>的参数时LLVM中的编译错误

时间:2017-05-16 07:23:25

标签: c++ llvm

使用LLVM 3.1时,我想调用函数findUsedStructTypes,该函数在文件Module的类include/llvm/Module.h中声明:

/// findUsedStructTypes - Walk the entire module and find all of the
/// struct types that are in use, returning them in a vector.
void findUsedStructTypes(std::vector<StructType*> &StructTypes) const;

鉴于M是类Module的变量,我调用上述函数的实际代码是:

std::vector<llvm::StructType*> all_structs;
M.findUsedStructTypes(all_structs);

但是,在编译时,会抛出一个错误:

undefined reference to `llvm::Module::findUsedStructTypes(std::vector<llvm::StructType*, std::allocator<llvm::StructType*> >&) const'
collect2: error: ld returned 1 exit status

我是LLVM的新手,并且对C ++没有多少经验,因此无法弄清楚为什么会出现这样的错误。

有人可以帮我解释我的代码有什么问题吗?

感谢你花时间看我的问题。

0 个答案:

没有答案