[cfe-dev] which libs do I need to link to build the c-index-test?

asmwarrior asmwarrior at gmail.com
Fri Jan 14 20:01:52 PST 2011

On 2011-1-14 23:26, Douglas Gregor wrote:
> On Jan 14, 2011, at 12:47 AM, Asm warrior wrote:
>> Hi, I'm a mingw user, and I have succefully build llvm+clang under
>> msys+mingw. (yes, c-index-test build Ok under MSYS).
>> Now, I just copy the source code: (renamed it as main.cpp to my
>> codeblocks project)
>> E:\svn_llvm\llvm\tools\clang\tools\c-index-test\c-index-test.c
>> then, I try to add some include search path and lib search path.
> c-index-test should only need to link against libclang, since it uses the C interface to Clang.
> 	- Doug

Thanks for your reply!!
Now, I have successfully build my c++ project.

I just follow these these way:
I go to the folder:
and run the command:


This way, I get the verbose of the build log, then all the libraries I 
need to build my project(c++ project), they are listed here:


Also, some extra Macros:

Then, I need to change the source code a little to build it as a c++ source.
The first one is:
change the code:
extern char *basename(const char *);
extern "C" char *basename(const char *);

since the basename function is in a gnu c library
The second one is:
change the code:
thread_info *client_data = client_data_v;
thread_info *client_data = (thread_info*)client_data_v;

since the c++ compiler has more type check.
Hope this information can help others to use the code to their c++ 
project under MinGW.

ollydgb from Codeblocks' forum

More information about the cfe-dev mailing list