我一直在通过使用Flex,野牛和LLVM编译器写的教程工作(http://gnuu.org/2009/09/18/writing-your-自己的玩具编译/),并试图编译最终的二进制失败,很多下面的“未定义的引用”错误:无法连结针对LLVM与项目包括Flex和Bison
g++ -o parser `llvm-config --libs core jit native --cxxflags --ldflags` *.cpp
/tmp/ccl0CSyi.o: In function `NBinaryOperator::codeGen(CodeGenContext&)':
codegen.cpp:(.text+0x2ce): undefined reference to `llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*, llvm::Value*, llvm::Twine const&, llvm::BasicBlock*)'
/tmp/ccl0CSyi.o: In function `NDouble::codeGen(CodeGenContext&)':
codegen.cpp:(.text+0x3db): undefined reference to `llvm::getGlobalContext()'
codegen.cpp:(.text+0x3e3): undefined reference to `llvm::Type::getDoubleTy(llvm::LLVMContext&)'
/tmp/ccl0CSyi.o: In function `NInteger::codeGen(CodeGenContext&)':
...
collect2: ld returned 1 exit status
make: *** [parser] Error 1
据我知道,我拥有所有必要的包括和llvm-配置脚本工作正常---有没有人有任何想法如何解决这些错误?
谢谢!你是最棒的。 – Dylon 2011-03-06 03:30:22