Home Dashboard Directory Help
Search

IntelliSense: PCH warning: Can not find a suitable header stop location. A PCH file wasn't generated. by tom_mai78101


Status: 

Closed
 as By Design Help for as By Design


3
0
Sign in
to vote
Type: Bug
ID: 650359
Opened: 3/9/2011 5:23:09 AM
Access Restriction: Public
3
Workaround(s)
view
3
User(s) can reproduce this bug

Description

Here's the thread that was posted a week ago, by me.

http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/d41f9aea-4425-48fd-9e3b-4169ffc38e6f

This error occurred after I had installed Visual Studio 2010 SP1 Beta. In the thread, I have provided a picture. I don't know how to provide a picture over here in Microsoft Connect.

It's possible that if there are no headers, this error may occur.
Details
Sign in to post a comment.
Posted by zhangxaochen on 6/9/2014 at 7:03 AM
@Ulzii Luvsanbat, "to just disable PCH usage for that one cpp file you've added" -- this does not work for me. I had to add "#whatever" on my machine...
Posted by thaimin on 5/10/2011 at 12:49 PM
This is still a problem. Disabling PCH for a single file and the whole solution does NOT fix the issue. Compiling works fine. Also, I cannot use the solution provided in the above link since, due to program restraints, I cannot include any headers.
Posted by Microsoft on 3/21/2011 at 6:13 PM
Hello Tom,

Thank you for your feedback. And yes, there is a good explanation for this. As you know, by default all VC++ projects are PCH-enabled at the project level, and therefore when you add a new .cpp file to the project it will inherit the PCH settings as well. Now, when you do a build after you've just added a new .cpp file without including any header, compiler will actually give you an error saying the same message as the IntelliSense warning you're seeing. Essentially, you're telling the compiler to use /Yu a pch that was created before, in a compilation unit that doesn't use the anything from the pch.
What you can do is, to just disable PCH usage for that one cpp file you've added, which will clear both IntelliSense and compiler warning/error.

Thanks,
Ulzii Luvsanbat
Windows C++ Team
Posted by tom_mai78101 on 3/10/2011 at 6:31 AM
Oh goody! Loved to hear some detailed explanations about this troubled IntelliSense problem. :)
Posted by Microsoft on 3/9/2011 at 6:29 PM
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 3/9/2011 at 6:13 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Indinfer on 2/23/2012 at 6:10 PM
I just wanted to point out that ANY # before the first C statement will silence this particular warning.

#if 0
#endif

also works.

Instead of VS requiring an #include of a precompiled header, VS is requiring that there be a # before the first C statement. And that is a weird requirement!
Posted by Indinfer on 2/23/2012 at 5:54 PM
I silence the IntelliSense warning by puting

    #pragma

at the top of the file -- Just "#pragma" without any parameters.
Posted by Rossi88 on 11/24/2011 at 7:37 AM
I have the same issue. In my case the step to solve the problem is:

1)copy the content of the file and delete it
2)you can create another file (also with the same name) and add it to project
3)you can paste the code that was previously copied.