[cfe-dev] Including windows.h, include paths

Douglas Gregor dgregor at apple.com
Thu Oct 8 15:51:20 PDT 2009


On Oct 7, 2009, at 9:35 PM, John Thompson wrote:

> I was taking a crack at modifying Frontend/InitHeaderSearch.cpp to  
> use the Windows registry to find the Visual Studio installation  
> directory, but find that because of the /Za option used via cmake  
> (disables Microsoft extensions - ANSI only), windows.h won't compile.
>
> As an experiment I took out the /Za option from the clang/ 
> CMakeLists.txt file, but recompiling revealed some compile errors in  
> some string class.
> Any thoughts on either how to make this work, or whether I should  
> even be trying to read the registry?

I think that using the registry to find Visual Studio is exactly the  
right solution. If the code that includes windows.h is segregated into  
a separate .cpp file, we can add whatever /Z??? flag is needed to make  
that one file handle windows.h

> On a related note, should not InitHeaderSearch also be using the  
> target triple information to determine which include path to use?   
> I've enclosed a patch that attempts to do it.  This would be  
> important for cross-compiling, I gather.  It also has revised code  
> for getting the Visual Studio include path from the environment,  
> plus the disabled code for the registry stuff.

I agree that InitHeaderSearch should use target triple information to  
determine which include paths to use.

	- Doug



More information about the cfe-dev mailing list