[cfe-dev] Linking errors
Douglas Gregor
dgregor at apple.com
Wed Sep 1 07:20:08 PDT 2010
On Sep 1, 2010, at 4:17 AM, Ilya Mirsky wrote:
> Hi,
>
> I've posted a similar question a few days ago, but didn't get a satisfying reply (Thanks Jan). Maybe this time...
> I'm trying to build a simple program which uses clang libs on linux with g++.
> After failing at the linking phase using the llvm-config --ldflags --libs script, I've tried to copy-paste the output of the script directly into the g++ command, but unfortunately I still get an enormous amount of "undefined refernce to..." error messages.
> What am I doing wrong? Please see the build output below:
>
>
> -lclang -lclangAnalysis -lclangAST -lclangBasic -lclangChecker -lclangCodeGen -lclangDriver -lclangFrontend -lclangFrontendTool -lclangIndex -lclangLex -lclangParse -lclangRewrite -lclangSema -lclangSerialization
Your link line is ordered incorrectly. The makefile for the "clang" executable shows the correct order:
USEDLIBS = clangFrontendTool.a clangFrontend.a clangDriver.a \
clangSerialization.a clangCodeGen.a clangParse.a clangSema.a \
clangChecker.a clangAnalysis.a clangIndex.a clangRewrite.a \
clangAST.a clangLex.a clangBasic.a
- Doug
More information about the cfe-dev
mailing list