我使用的是 Fedora-11 系统,最近我安装了 LLVM (
我得到了这个:
sudo yum -y install llvm llvm-docs llvm-devel
)。当我搜索 LLVM 时,它们在 /usr/bin
中。其中一些二进制文件的链接已经损坏(llvm-gcc
、llvm-g++
、llvm-cpp
等)。包含文件在 /usr/include/llvm
中,库在 /usr/lib/llvm
中。如何使用 g++
编译它们?我尝试按照 tutorial 中的指示编译给出的万花筒代码,但编译失败。我得到了这个:
toy.cpp:5:30: error: llvm/LLVMContext.h: No such file or directory
toy.cpp:352: error: ‘getGlobalContext’ was not declared in this scope
toy.cpp: In member function ‘virtual llvm::Value* NumberExprAST::Codegen()’:
toy.cpp:358: error: ‘getGlobalContext’ was not declared in this scope
toy.cpp: In member function ‘virtual llvm::Value* BinaryExprAST::Codegen()’:
toy.cpp:379: error: ‘getDoubleTy’ is not a member of ‘llvm::Type’
toy.cpp:379: error: ‘getGlobalContext’ was not declared in this scope
toy.cpp: In member function ‘llvm::Function* PrototypeAST::Codegen()’:
toy.cpp:407: error: ‘getDoubleTy’ is not a member of ‘llvm::Type’
toy.cpp:407: error: ‘getGlobalContext’ was not declared in this scope
toy.cpp:408: error: ‘getDoubleTy’ is not a member of ‘llvm::Type’
toy.cpp: In member function ‘llvm::Function* FunctionAST::Codegen()’:
toy.cpp:454: error: ‘getGlobalContext’ was not declared in this scope
toy.cpp: In function ‘int main()’:
toy.cpp:543: error: ‘LLVMContext’ was not declared in this scope
toy.cpp:543: error: ‘Context’ was not declared in this scope
toy.cpp:543: error: ‘getGlobalContext’ was not declared in this scope
我也找不到LLVMContext.h
文件。所以我猜这可能是一个版本问题。
要怎么做才能使它工作?
有人能帮忙吗?先谢谢了... :)