IntelliSense: PCH warning: header stop cannot be in a macro or #if block. An intellisense PCH file was not generated. - by tom_mai78101

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 665628 Comments
Status Closed Workarounds
Type Bug Repros 6
Opened 4/28/2011 10:41:24 PM
Access Restriction Public


This appeared when I write the code shown below this dotted line.

More information in the Comments.

Do you suppose there's a way to turn off /Yu compiler option by default?


#ifndef MAIN_H
#	define MAIN_H
#	ifndef WIN32_LEAN_AND_MEAN
#		define WIN32_LEAN_AND_MEAN
#	endif

#include <Windows.h>
#include <D3D10.h>
#include <D3DX10.h>

//Going to make a class.
//First, a namespace.
namespace Core

//The main Win32 method.

//The main Window Procedure method.

#endif //End of MAIN_H
Sign in to post a comment.
Posted by PUREJ on 7/6/2011 at 5:10 PM
it worked before, so it must be solvable or am i missing something?
i don't use #pragma once but the 3 split ifndef/define/endif, highlighting looks fine, VS sees that the code region is active, why doesn't intellisense see it?
i am not using precompiled headers too.
Posted by Tanveer [MSFT] on 5/24/2011 at 4:15 PM
Thank you for reporting this issue to Microsoft. This is a case of the Visual Studio warning you that an Intellisense PCH, which is similar to the compiler PCH, could not be generated for your current source file. VC++ Intellisense generates these PCHs automatically but in this case fails to find a declaration that is outside of a #if-block (it needs a good point in your program to save PCH information). But there is no ill effect in this case except perhaps slower Intellisense. You could try to make sure main.h is #included from a source file - in that case you should not be seeing this error at all but in the cases you see this error, it should have no effect on the compilation of the source as the Intellisense engine is separate from the C++ compiler.

Tanveer Gani
Visual C++ Team.
Posted by TWC2102 on 5/11/2011 at 1:56 PM
Note that this error occurred as soon as I installed SP1 and Visual Studio Pro. I did not have this problem when I was using express last week.
Posted by TWC2102 on 5/11/2011 at 1:54 PM
I have the same error with nested namespaces. The error line actually refers to the namepsace declaration line in my case.
Posted by tom_mai78101 on 4/30/2011 at 1:09 AM
I wished that whatever I typed in Visual Studio, anything won't bother me with errors. :)
Posted by Microsoft on 4/29/2011 at 1:22 AM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by Microsoft on 4/28/2011 at 11:13 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(
Posted by tom_mai78101 on 4/28/2011 at 10:49 PM
Ugh! Forgot to add, in the project's Properties, C/C++, Precompiled header settings, it is already set to "Not Using Precompiled Headers" when this error occurs.

Does this setting affect the IntelliSense generating such error in any way?