[cfe-dev] undefined reference to typeinfo for clang::ASTFrontendAction

Eli Bendersky eliben at gmail.com
Fri Nov 5 07:11:19 PDT 2010


On Fri, Nov 5, 2010 at 15:51, Dimitrij Kotrev <
dimitrij.kotrev at googlemail.com> wrote:

> Hello cfe-dev,
>
> trying to compile this simple code, but somehow it doesnt work. Can
> somebody point me to what i'm missing.
>
> #define __STDC_LIMIT_MACROS
> #define __STDC_CONSTANT_MACROS
>
> #include <clang/Frontend/CompilerInstance.h>
> #include <clang/Frontend/FrontendAction.h>
>
> class MyASTAction: public clang::ASTFrontendAction {
> public:
> protected:
>       virtual clang::ASTConsumer*
> CreateASTConsumer(clang::CompilerInstance &CI,
>                       llvm::StringRef InFile) {
>               return 0;
>       }
>
> private:
> };
>
> int main(int argc, const char** argv) {
>       MyASTAction action;
>
>       return 0;
> }
>
>
> **** Build of configuration Debug for project clangtest ****
>
> make all
> Building file: ../main.cpp
> Invoking: GCC C++ Compiler
> g++ -I/home/dima/Software/llvm-2.8/include -O0 -g3 -Wall -c
> -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o"main.o"
> "../main.cpp"
> Finished building: ../main.cpp
>
> Building target: clangtest
> Invoking: GCC C++ Linker
> g++ -L/home/dima/Software/llvm-2.8-dbg/lib -o"clangtest"  ./main.o
> -lclangFrontend -lclangSerialization -lclangDriver -lclangCodeGen
> -lclangSema -lclangChecker -lclangAnalysis -lclangRewrite -lclangAST
> -lclangParse -lclangLex -lclangBasic -lLLVMMC -lLLVMCore -lLLVMSupport
> -lLLVMSystem -lpthread -ldl -lm
> ./main.o:(.rodata._ZTI11MyASTAction[typeinfo for MyASTAction]+0x10):
> undefined reference to `typeinfo for clang::ASTFrontendAction'
> collect2: ld returned 1 exit status
> make: *** [clangtest] Fehler 1
> ________________________________________
>

The ASTFrontendAction class derives from FrontendAction, which has several
pure virtual functions. Are you sure you have overridden all of them?

Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101105/ed28b862/attachment.html>


More information about the cfe-dev mailing list