[cfe-dev] How to tell the preprocessor where it can find its header files ?

Charles Davis cdavis at mymail.mines.edu
Thu Feb 25 18:29:13 PST 2010

kalyan ponnala wrote:
> Hello,
> I am using llvm/clang solution file generated by visual studio. When I
> say -- "Clang-test"  -- > Set as Start-up Project -> build. I generates
> a bunch of errors saying it cant find
> the include files stdio.h, stdlib.h, limits.h. Now how can I tell the
> preprocessor where it can find its header files. Do I have to add some
> commands to the visual studio or Do I have to change the helper class
> "InitHeaderSearch" inside the InitHeaderSearch.cpp of the clangFrontend
> target. If I have to modify the code then can an expert guide me through
> the modifications that have to be made.
Same as with any compiler, even MSVC: you pass a -I switch. (When you
set the include paths in the project properties, internally, the VS IDE
passes -I switches to the compiler proper.)

Put it on clang's command line like so:

clang "-I\Path\to\Visual\Studio\Dir\VC\Include" <other switches>

Replace \Path\to\Visual\Studio\Dir with the actual path to the Visual
Studio directory.


More information about the cfe-dev mailing list