Hi,<br>I am new to clang. I was trying to invoke the AnalysisManager object and use it in a program. I am quoting relevant parts of the code.<br><br><br>CXIndex index = clang_createIndex(1, 0);<br>CXTranslationUnit tu = clang_createTranslationUnitFromSourceFile(index,<br>
"simple.c", 0, 0x0, 0, 0x0);<br>ASTUnit *astUnit = static_cast<ASTUnit *> (tu);<br>Preprocessor &pe = astUnit->getPreprocessor();<br>AnalysisManager AMgr(astUnit->getASTContext(), pe.getDiagnostics(),<br>
pe.getLangOptions(), 0,<br> 0,<br> 0, &Idxer,<br> /* MaxNodes */ 300, /* MaxVisit */ 3,<br> /* VisualizeEG */ false, /* VisualizeEGUbi */ false,<br>
/* PurgeDead */ true, /* EagerlyAssume */ false,<br> /* TrimGraph */ false, /* InlineCall */ true,<br> /* UseUnoptimizedCFG */ false, false, false);<br>
<br><br><br>Now, I am compiling the program with the following command.<br><br>g++ -O2 -g -Wall -fmessage-length=0 -D __STDC_LIMIT_MACROS=1 -D __STDC_CONSTANT_MACROS=1 -I/home/munawar/install/llvm/tools/clang/tools/libclang -o llvmTest llvmTest.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CIndex.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CXCursor.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CXType.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CIndexer.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CIndexDiagnostic.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CIndexUSRs.o -lclangIndex -lclangChecker -lclangFrontend -lclangSema -lclangLex -lclangParse -lclangDriver -lclangAnalysis -lclangSerialization -lclangAST -lclangBasic -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMSystem -lpthread -ldl <br>
<br>The interesting and probably relevant part is the library sequence.<br><br>-lclangIndex -lclangChecker -lclangFrontend -lclangSema -lclangLex
-lclangParse -lclangDriver -lclangAnalysis -lclangSerialization
-lclangAST -lclangBasic -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMSystem
-lpthread -ldl <br><br>But I am getting this error,<br><br>llvmTest.o:(.rodata._ZTIN5clang15AnalysisManagerE[typeinfo for clang::AnalysisManager]+0x8): undefined reference to `typeinfo for clang::BugReporterData'<br>
collect2: ld returned 1 exit status<br><br>Can you please point out where I am making a mistake ? Thanks.<br><br><br>Munawar<br>