Hi!<div>I'm trying to learn LLVM and I want to compile the Kaleidoscope compiler.</div><div>according to:</div><div><a href="http://llvm.org/docs/tutorial/LangImpl3.html">http://llvm.org/docs/tutorial/LangImpl3.html</a></div>
<div><br></div><div>I'm compiling it with:</div><div><div>clang++ -g -O3 test.cpp `llvm-config --cppflags --ldflags --libs core` -o toy</div></div><div><br></div><div>and it indeed works.</div><div>The problem is that when using eclipse it forces me to divide the compilation into two steps:</div>
<div><br></div><div>g++ -O0 -g3 -Wall -c -fmessage-length=0 `llvm-config --cppflags --ldflags --libs core` -MMD -MP -MF"src/lunac.d" -MT"src/lunac.d" -o "src/test.o" "../src/test.cpp"</div>
<div>(which compiles fine)</div><div><br></div><div>and:</div><div><br></div><div><div>Invoking: Cross G++ Linker</div><div>g++ `llvm-config --cppflags --ldflags --libs core` -o "test"  ./src/test.o</div></div><div>
<br></div><div>which gives me error:</div><div><div>./src/test.o: In function `NumberExprAST::Codegen()':</div><div>/home/wdanilo/dev/lunac/Debug/../src/test.cpp:358: undefined reference to `llvm::APFloat::APFloat(double)'</div>
<div>/home/wdanilo/dev/lunac/Debug/../src/test.cpp:358: undefined reference to `llvm::getGlobalContext()'</div><div>/home/wdanilo/dev/lunac/Debug/../src/test.cpp:358: undefined reference to `llvm::ConstantFP::get(llvm::LLVMContext&, llvm::APFloat const&)'</div>
</div><div>[...]</div><div><br></div><div>Why Linker is not working with these flags? How can I fix it?</div><div><br></div>