简单的CPP文件无法使用Clang进行编译

时间:2013-09-03 16:09:46

标签: clang llvm

#include "clang/AST/ASTConsumer.h"  
#include "clang/AST/RecursiveASTVisitor.h"  
#include "clang/Basic/Diagnostic.h"  
#include "clang/Frontend/CompilerInstance.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/Rewriter.h"  
#include "clang/Rewrite/Rewriters.h"  
#include "llvm/Support/Host.h"  

int main()  
{  
    return 0;  
}  

我正在将其编译为

clang++ -I/home/pc/llvm-3.3.src/tools/clang/include -I/home/pc/llvm-3.3-build/tools/clang/include -I/usr/local/include  -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-uninitialized -Wnon-virtual-dtor   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti   -c -o simple.o simple.cpp

我收到错误'clang/Rewrite/Rewriter.h' file not found

1 个答案:

答案 0 :(得分:3)

大约一年前(在llvm 3.2发布之前),ClangRewrite分为2个库:ClangRewriteCore和ClangRewriteFrontend。

这意味着:

  • clang / Rewrite / Rewriter.h 现在是 clang / Rewrite / Core / Rewriter.h
  • clang / Rewrite / Rewriters.h 现在是 clang / Rewrite / Frontend / Rewriters.h
  • libclangRewrite.a 现在是 libclangRewriteCore.a libclangRewriteFrontend.a

您可以在LLVM存储库here中看到更改。