【发布时间】:2015-05-14 07:41:27
【问题描述】:
我是 Linux 新手,正在学习一些 clang 教程。但是,我发现即使是一个简单的文件也很难编译。所以,这里是部分代码:
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <utility>
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Parse/ParseAST.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "clang/Rewrite/Frontend/Rewriters.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
using namespace std;
当我尝试使用以下命令编译简单代码(比如说 PrintFunctions.cpp)时:
clang++ -o PrintFunctions PrintFunctions.cpp
我得到了错误:
致命错误:找不到“clang/AST/ASTConsumer.h”文件
嗯,我已经检查了我的 LLVM 和 clang 已经安装好了,并且文件 'clang/AST/ASTConsumer.h' 在
/usr/lib/llvm-3.4/include/clang/AST
所以,我在指挥中一定有什么遗漏的。我不知道该怎么做...我在网上阅读了一些教程,其中大多数都使用了makefile,它们似乎很复杂。 那么,如何编译呢?如何找到更简单的makefile编写方法?
顺便说一句,我在 Ubuntu 14.04 下,clang/LLVM 版本是 3.4。
【问题讨论】:
标签: c++ linux makefile clang llvm