[cfe-dev] C++ compilation error
NAKAMURA Takumi
geek4civic at gmail.com
Tue Mar 15 02:40:09 PDT 2011
2011/3/15 Grégory Ruch <gregory.ruch at heig-vd.ch>:
> I compile with :
>
> g++ `/home/[...]/install/bin/llvm-config --cxxflags`
> `/home/[...]/install/bin/llvm-config --ldflags` -lclangFrontend
> test.cpp -o test
>
> /tmp/cccJ7SSH.o: In function `main':
> test.cpp:(.text+0xc6): undefined reference to
> `clang::CompilerInstance::CompilerInstance()'
> test.cpp:(.text+0xce): undefined reference to
> `clang::CompilerInstance::~CompilerInstance()'
> collect2: ld returned 1 exit status
- "test.cpp" should be placed in front of -lfoo.
- "-lclangFrontend" denends on several libraries.
(I don't know how to know dependencies)
You may pick up maximum dependency from
tools/clang/tools/driver/Makefile. :p
- clang libs depend on llvm libs.
You may do;
$ g++ `bin/llvm-config --cxxflags --ldflags` test.cpp \
-lclangFrontend -lclangDriver -lclangSerialization \
-lclangParse -lclangSema -lclangAnalysis \
-lclangAST -lclangLex -lclangBasic \
`bin/llvm-config --libs`
...Takumi
More information about the cfe-dev
mailing list