c++ - LLVM Basic Program : Linker Error -
I'm just starting with llvm
Here I am trying to compile the code:
#include & lt; Stdio.h & gt; # Include "llvm / IR / LLVMContext.h" #included "llvm / IR / Module.h" # included "llvm / IR / IRBuilder.h" int main () {llvm :: LLVMCXX & amp; Context = llvm :: getGlobalContext (); Llvm :: module * module = new llvm :: module ("top", reference); LLVM :: IRBuilder & lt; & Gt; Builder (reference); Module-> dump (); }
When I compile with:
LLVM-G ++ try.cpp -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS `LLVM-config --cxxflags --ldflags --libs `
I get a.out file. No worries
However, I am interested in getting the LLVM IR file.So, I compiled with
LLVM-G ++ try.cpp -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -S - Throw-LLVM lli try.s
I get an error saying
LLVM error: External function used for program '_ZN4llvm16getGlobalContextEv' Which can not be solved!
Order:
LLVM-G ++ try.cpp -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS `LLVM-config --cxxflags --ldflags --libs` - S-MAT-LLM
I leave with many warnings and when I execute the resulting .s file with redness, I get the same error as before.
Thanks a lot for your help
Comments
Post a Comment