how to build this program..

Hi,
This program was given as an example by Mr. Gregor under the topic " libclang: Thinking Beyond the Compiler "

int main(int argc, char *argv[])
{
unsigned I;
CXIndex Index = clang_createIndex(0, 0);
CXTranslationUnit TU = clang_parseTranslationUnit(
Index, 0,argv,
argc, 0, 0, CXTranslationUnit_None);
CXTranslationUnit N;

for (I = 0, N = clang_getNumDiagnostics(TU); I != N; ++I)
{
CXDiagnostic Diag = clang_getDiagnostic(TU, I);
CXString String =
clang_formatDiagnostic(Diag,clang_defaultDiagnosticDisplayOptions());
fprintf(stderr, “%s\n”, clang_getCString(String));
clang_disposeString(String);
}

clang_disposeTranslationUnit(TU);
clang_disposeIndex(Index);

return 0;
}

Can somebody tell me which headers i have to include?
and how can i compile this program?

i have installed llvm and clang (2.9) on my system.

Thanks in advance.

Hi,

If you want to use libclang.Please include “clang-c/Index.h”, and link with libclang.

2011/1/12 jignesh vasoya <jigneshvasoya@gmail.com>