<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Hi all,<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">I'm trying a quick experiment with clang-c and I've noticed something that seems weird. If I compile the program at the end of this email like so<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">$ g++ -Iclang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04/include -g -Wall tc.cpp -Lclang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04/lib -lclang -o tc<br>tc.cpp:21: error: undefined reference to 'clang_CompileCommand_getNumMappedSources'<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">I'm a tad baffled by this because the complimentary functions clang_CompileCommand_getMappedSourcePath and clang_CompileCommand_getMappedSourceContent do exist.<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">In the pre-built package I'm using (4.0.0, see above), it seems the thing doesn't exist at all?<br><br>$ strings clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04/lib/* | grep clang_CompileCommand | sort -u<br>clang_CompileCommand_getArg<br>clang_CompileCommand_getDirectory<br>clang_CompileCommand_getFilename<br>clang_CompileCommand_getMappedSourceContent<br>clang_CompileCommand_getMappedSourcePath<br>clang_CompileCommand_getNumArgs<br>clang_CompileCommands_dispose<br>clang_CompileCommands_getCommand<br>clang_CompileCommands_getSize<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">Am I going crazy? Where is it? :)<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">tc.cpp:<br>#include <stdlib.h><br>#include <stdio.h><br>#include <assert.h><br>#include <clang-c/CXCompilationDatabase.h><br><br>int main() {<br>  CXCompilationDatabase db;<br>  CXCompilationDatabase_Error err;<br>  const char *build_dir;<br><br>  build_dir = ".";<br>  db = clang_CompilationDatabase_fromDirectory(build_dir, &err);<br><br>  if (err != CXCompilationDatabase_NoError) {<br>    exit(1);<br>  }<br><br>  CXCompileCommands cmds = clang_CompilationDatabase_getAllCompileCommands(db);<br>  unsigned num_commands = clang_CompileCommand_getNumArgs(cmds);<br>  assert(num_commands > 0);<br>  printf("%d\n", clang_CompileCommand_getNumMappedSources(clang_CompileCommands_getCommand(cmds, 0)));<br><br>  return 0;<br>}<br><br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Kind regards & TIA,<br><br></div><div class="gmail_default" style="font-family:monospace,monospace">/Charlie.<br></div></div>