username_4567
username_4567

Reputation: 4903

Simple CPP file failed to compile with Clang

#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;  
}  

I am compiling it as

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

I am getting error as 'clang/Rewrite/Rewriter.h' file not found

Upvotes: 1

Views: 978

Answers (1)

Bill Lynch
Bill Lynch

Reputation: 81916

About a year ago (before the release of llvm 3.2), ClangRewrite was split into 2 libraries: ClangRewriteCore and ClangRewriteFrontend.

This means that:

  • clang/Rewrite/Rewriter.h is now clang/Rewrite/Core/Rewriter.h.
  • clang/Rewrite/Rewriters.h is now clang/Rewrite/Frontend/Rewriters.h.
  • libclangRewrite.a is now libclangRewriteCore.a and libclangRewriteFrontend.a.

You can see the change in the LLVM repository here.

Upvotes: 4

Related Questions