Use of undeclared identifier error


I've got a program using libclang to compile C/C++ scripts at run-time. When trying to use it with libstdc++, specifically <string>, although I get similar errors when using other standard headers, I get errors of the form "use of undeclared identifier '__builtin_clz'; did you mean '__builtin_clz'?" or "unknown type name '__builtin_va_list'; did you mean '__builtin_va_list'?"

I've checked the list of identifiers to see that __builtin_clz (and others that it's complaining about) are in there, and __builtin_va_list is defined in the ASTContext.

The full code for how I've set up and am calling the compilation are at Scripter::Scripter() : imfs(new clang::vfs::InMemoryFileSystem), file_ - and the output from clang::ParseAST when including <string> is at We got __builtin_clzWe got __builtin_va_listIn file included from /src/scrip - . Despite the outside saying that those builtins exist, using the program at We got __builtin_clzWe got __builtin_va_listIn file included from /src/scrip - says that the builtins don't exist at compilation time.


Rohan Smith