不能在 llvm 中转换 ConstantInt

sma*_*ato 0 llvm

以下代码:

ConstantInt * Idx = cast<ConstantInt>(gepi->getOperand(2));
Run Code Online (Sandbox Code Playgroud)

产生以下错误:

error: invalid use of incomplete type ‘struct llvm::ConstantInt’
error: forward declaration of ‘struct llvm::ConstantInt’
Run Code Online (Sandbox Code Playgroud)

我不知道为什么这个演员不起作用。我正在使用 llvm 3.1。有什么帮助吗?

arr*_*owd 5

添加#include <Constants.h>到您的来源。