[llvm-bugs] [Bug 27393] New: libClang Cannot Locate Header Files Of User Made Libraries And Projects

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 17 15:45:07 PDT 2016


            Bug ID: 27393
           Summary: libClang Cannot Locate Header Files Of User Made
                    Libraries And Projects
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nko12 at comcast.net
                CC: klimek at google.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Visual Studio 2015 Update 2
Windows 10 1511
libclang 3.8

I want to use clang to generate reflection metadata for use in some personal
projects that I'm working on. I am following this tutorial

The tutorial has me creating a dummy file that includes all the header files I
would like to use to build up the AST. As a test, my current dummy file
includes two header files (using full, absolute path names), both of which
include header files of the following names:
#include <ConsoleMenu.h>
#include <vector>
#include <clang-c/Index.h>

Right now, my list of command line arguments looks like the following:

std::vector<std::string> args;

    args.push_back(R"(-I C:\Program Files (x86)\Microsoft Visual Studio
    args.push_back(R"(-I C:\Program Files (x86)\Microsoft Visual Studio
    args.push_back(R"(-I C:\Program Files (x86)\Windows
    args.push_back(R"(-I C:\Program Files (x86)\Windows Kits\8.1\Include\um)");
    args.push_back(R"(-I C:\Program Files (x86)\Windows
    args.push_back(R"(-I C:\Program Files (x86)\Windows

    args.push_back(R"(-I D:\Libraries\ConsoleMenu\include)");
    args.push_back(R"(-I C:\Program Files (x86)\LLVM\include)");

    args.push_back(R"(-D _Debug=1)");

Notice the last two includes before the compatibility option. The first include
is to another project's include directory, and the second is to the LLVM
include directory. <ConsoleMenu.h> is located in the first include directory,
and <clang-c/Index.h> is located in the second.

Upon executing clang_parseTranslationUnit with this dummy file and the given
list of compilation arguments, I get the following single error

"fatal error: 'clang-c/Index.h' file not found"

If I move the libclang include statement into the source file that is using it,
I get the following error

"fatal error: 'ConsoleMenu.h' file not found"

Note, however, that finding the standard C++ vector header file was performed
without issue. Visual Studio's cl compiler fully compiles the code associated
with these header files without issue. All the include directories in the list
of arguments are what the cl compiler is using. Precompiled header file is not
being used.

This leads me to believe libclang can locate standard and system header files
from the search path, but not user defined header files.

Any suggestions? Chances are, I'm making some simple, obvious mistake here.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160417/aeeddfcc/attachment.html>

More information about the llvm-bugs mailing list