我使用的是fedora-11系统,最近我安装了llvm ( sudo yum -y install llvm llvm-docs llvm-devel )。当我搜索llvm时,我在/usr/bin中得到它们。一些指向二进制文件的链接已断开(llvm-gcc、llvm-g++、llvm-cpp等)。包含文件可以在/usr/lib/llvm的/usr/include/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文件。所以我猜这可能是一个版本问题。我该怎么做才能让它工作呢?
一些帮助将是好的!先谢谢你...:)
发布于 2011-03-22 05:28:26
看起来标头没有安装,或者安装在你不使用的路径中。我的建议是从llvm.org网站或svn下载代码,并使用它来构建万花筒示例。它相当简单,所有代码都在examples目录中。
发布于 2013-02-12 18:30:03
不使用yum,而是通过this或this链接安装clang/llvm。
https://stackoverflow.com/questions/2565960
复制相似问题