[cfe-dev] C++ compilation error

Grégory Ruch gregory.ruch at heig-vd.ch
Tue Mar 15 03:25:35 PDT 2011


On 03/15/2011 10:40 AM, NAKAMURA Takumi wrote:
> 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
I understand my mistake now ! It works !

Thank you very much !



More information about the cfe-dev mailing list