c++ - How to use libclang with STL? -


i'm trying parse library using libclang, , i'm stuck simple issue: how configure stl? @ moment, fails parse translation unit because can't find .

here's tried :

char *args[] = {"-x", "c++", "-ic:/my/library/includes", "-ig:/prog/libcxx-3.4/include"}; clang_parsetranslationunit(index, "c:/my/library/test.cpp", args, 4, 0, 0, 0); 

i'm on windows, precompiled clang binaries downloaded llvm.org, , tried various stl implementations :

  • visual studio
  • mingw
  • libcxx

in each case, ended unknown types.

for example, mingw, i've got following error messages :

/mingw/include\wchar.h:221:71: error: unknown type name '_locale_t' /mingw/include\wchar.h:223:81: error: unknown type name '_locale_t' /mingw/include\stdlib.h:173:65: error: unknown type name '_locale_t' /mingw/include\stdlib.h:175:75: error: unknown type name '_locale_t' /mingw/include\io.h:301:14: error: unknown type name 'off64_t' /mingw/include\io.h:301:36: error: c++ requires type specifier declarations /mingw/include\io.h:302:14: error: unknown type name 'off64_t' /mingw/include\io.h:302:39: error: unknown type name 'off64_t' /mingw/include\unistd.h:65:20: error: unknown type name 'off_t'

the rare tutorials i've found subject don't talk subject...

since libclang precompiled, doesn't know exact paths of standard libraries used compilers. you'll have tell standard include path using -i switches in arguments list, when calling clang_parsetranslationunit.

here command use find inclusion paths gcc on linux. should able adapt mingw in windows environment:

$ echo "" | g++ -v -x c++ -e - 
... #include "..." search starts here: #include <...> search starts here:  /usr/include/c++/4.8  /usr/include/x86_64-linux-gnu/c++/4.8  /usr/include/c++/4.8/backward  /usr/lib/gcc/x86_64-linux-gnu/4.8/include  /usr/local/include  /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed  /usr/include/x86_64-linux-gnu  /usr/include end of search list. ... 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -