首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何用llvm和g++编译?

如何用llvm和g++编译?
EN

Stack Overflow用户
提问于 2010-04-02 17:39:58
回答 2查看 4.7K关注 0票数 3

我使用的是fedora-11系统,最近我安装了llvm ( sudo yum -y install llvm llvm-docs llvm-devel )。当我搜索llvm时,我在/usr/bin中得到它们。一些指向二进制文件的链接已断开(llvm-gccllvm-g++llvm-cpp等)。包含文件可以在/usr/lib/llvm/usr/include/llvm和库中找到。如何使用g++编译它们?我尝试按照指令编译tutorial中给出的万花筒代码,但编译失败。

我明白了:

代码语言:javascript
复制
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文件。所以我猜这可能是一个版本问题。我该怎么做才能让它工作呢?

一些帮助将是好的!先谢谢你...:)

EN

回答 2

Stack Overflow用户

发布于 2011-03-22 05:28:26

看起来标头没有安装,或者安装在你不使用的路径中。我的建议是从llvm.org网站或svn下载代码,并使用它来构建万花筒示例。它相当简单,所有代码都在examples目录中。

票数 0
EN

Stack Overflow用户

发布于 2013-02-12 18:30:03

不使用yum,而是通过thisthis链接安装clang/llvm。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2565960

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档