我一直在通過使用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