<div dir="ltr"><div><div>Hi, <br><br></div>Excuse me but I have struggled with a link issue when compiling this one-line program, "Hello.cpp":<br><br><br>#include "llvm/Support/TargetSelect.h"<br>using namespace llvm;<br>int main(int argc, char **argv) {<br> InitializeNativeTarget();<br><br>}<br><br></div>I use this command line:<br><div><br> g++ -o Hello `llvm-config --libs --cxxflags --ldflags` ../src/Hello.cpp<br><br></div><div>The error message:<br><br>Hello.cpp:(.text._ZN4llvm22InitializeNativeTargetEv[_ZN4llvm22InitializeNativeTargetEv]+0x5): undefined reference to `LLVMInitializeX86TargetInfo'<br>Hello.cpp:(.text._ZN4llvm22InitializeNativeTargetEv[_ZN4llvm22InitializeNativeTargetEv]+0xa): undefined reference to `LLVMInitializeX86Target'<br>Hello.cpp:(.text._ZN4llvm22InitializeNativeTargetEv[_ZN4llvm22InitializeNativeTargetEv]+0xf): undefined reference to `LLVMInitializeX86TargetMC'<br>collect2: error: ld returned 1 exit status<br><br clear="all"></div><div><div><div><div><div>Any hint for the problem source? I am using LLVM 3.7 on a ubuntu 14.04 (VM). Thanks. <br clear="all"></div><div><div><div class="gmail_signature"><br>Zhoulai</div></div>
</div>
</div></div></div></div></div>