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

Dimitrij Kotrev dimitrij.kotrev at googlemail.com
Fri Nov 5 06:51:33 PDT 2010


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



More information about the cfe-dev mailing list