[cfe-users] Use of undeclared identifier error

Rohan Smith via cfe-users cfe-users at lists.llvm.org
Sat Oct 22 02:50:15 PDT 2016


Hi,

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 
http://pastebin.com/SASu4xMi and the output from clang::ParseAST when 
including <string> is at http://pastebin.com/UphYaNj8 . Despite the 
outside saying that those builtins exist, using the program at 
http://pastebin.com/UphYaNj8 says that the builtins don't exist at 
compilation time.

Cheers,

Rohan Smith




More information about the cfe-users mailing list