C1859 Unexpected Precompiled Header Error
Contents |
& Install by Heath Stewart Application Lifecycle Management Application Insights Release Management Team Foundation Server Testing Visual Studio Team Services All Languages Visual C++ Visual F# JavaScript TypeScript Python kb976656 .NET .NET .NET with Beth Massi ASP.NET by Scott Hanselman OData Team kb976656 download WPF Platform Development Apps for Windows Bing Edge Microsoft Azure Office 365 Development Web Data Development SQL Server SQL Server
Archive Msdn Microsoft Kb976656
Data Tools DocumentDB Visual C++ Team Blog Visual C++ Precompiled Header Errors on Windows 7 ★★★★★★★★★★★★★★★ November 12, 2009July 28, 2015 by Visual CPP Team // 24 Comments 0 0 0 Several
Disable The Analyze Compiler Option If It Is Enabled
customers have encountered the following error while using the Visual C++ compiler on Windows 7:
fatal error C1859: ‘stdafx.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem This error manifests under the following conditions: · The Visual C++ compiler is invoked on Windows 7. · Precompiled header (PCH) microsoft visual studio 2008 service pack 1 files are enabled. · /analyze is enabled (this is not a necessary condition, but it increases the probability of encountering this behavior). Despite the error message’s suggestion, “simply rerunning the compiler” probably won’t help the situation. Indeed, the underlying cause of this error is far from “simple” as it stems from an interaction between our venerable precompiled header architecture and the new security enhancements in Windows 7. Visual C++ Precompiled Headers and ASLR Precompiled header files store the “state” of a compilation up to a certain point, and that state information can be reused in subsequent compiler invocations to significantly increase build throughput. For the past 15 years, our compiler has persisted precompiled headers to disk and reloaded them directly into virtual memory with 99.999% reliability and considerable performance gains. The tradeoff, however, was a degree of fragility in our architecture. Since the PCH file itself contains internal pointers, it must be loaded at the exact same address in virtual memory where it was created. The pointers will be inaccurate if the PCH is loaded at a different address in subsethe projects in the solution I am working with are C#, but some are C++. Periodically I get the following error building every
/analyze Visual Studio
single source file in the C++ project on my machine: fatal error C1859: 'Debug\MyProject.pch' unexpected precompiled header error, simply rerunning the compiler might fix this problem Nothing I did seemed to solve the problem short of rebooting, which seems to be a common experience (see here and here). Today I stumbled upon a post on the Visual C++ Team Blog that https://blogs.msdn.microsoft.com/vcblog/2009/11/12/visual-c-precompiled-header-errors-on-windows-7/ explains what is going on. It turns out that the anti-malware improvements in Windows 7 are the culprit. PCH files are implemented basically as a memory dump, including pointers. This worked fine on previous versions of Windows, but Windows 7 upped the ante making this approach unworkable. The new behavior that fixes this problem is available in Visual Studio 2010. The Visual http://davidstechtips.com/2010/06/unexpected-precompiled-header-error-c1859-on-windows-7/ C++ team has also released a hotfix for Visual Studio 2008 SP1 with the fix. Resources Visual C++ Precompiled Header Errors on Windows 7 by Visual C++ Team Fix for Visual C++ 2008 SP1 compiler error C1859 on Microsoft Connect This entry was posted in Development and tagged C++, Visual Studio, Visual Studio 2008 on June 14, 2010 by David Potter. Post navigation ← SyntaxHighlighter Evolved WordPress Plugin Debugging .NET Web Services → 3 thoughts on “Unexpected precompiled header error C1859 on Windows 7” Aidan Ryan November 2, 2010 at 4:05 am Note that if you are building in VS2010 but targeting the VS2008 toolset, this hotfix still applies. Reply ↓ Jose Ramírez June 30, 2011 at 7:07 am Awesome. Seems to have worked perfectly for me. Thanks for sharing. Reply ↓ Carlos Pizarro December 2, 2011 at 3:28 pm Thank you Aidan Ryan! You saved my day Reply ↓ Leave a Reply Cancel reply Your email address will not be published. Required fields are marked *Comment Name * Email * Website Notify me of follow-up comments by email. Notify me of new post
Windows 2K3SP1,Windows 2K3SP2,Windows 2K8SP1,Windows 2K8SP2,Windows 2KSP4,Windows VISTASP0,Windows VISTASP1,Windows VISTASP2,Windows 7,Windows XPSP2,Windows XPSP3 Content Type Recommended Language(s) ENGLISH Operating System(s) Windows Released On 22 Jan 2010 12:00:00 KB976656 MS 976656 Hotfix http://leic.lumension.com/patches/2010/%7B9EA13280-A9BC-4B8A-85B7-1E2D3F21B942%7D.html for Visual Studio 2008 Service Pack 1 (All Languages) (See Notes) (Rev 2) Vendor Name microsoft Product Windows 2K3SP1,Windows 2K3SP2,Windows 2K8SP1,Windows 2K8SP2,Windows 2KSP4,Windows VISTASP0,Windows VISTASP1,Windows VISTASP2,Windows 7,Windows XPSP2,Windows XPSP3 Released On 22 Jan 2010 12:00:00 Url http://support.microsoft.com/kb/976656 Description Install this update to address the following issue: When you run the Microsoft Visual C++ 2008 compiler to compile files or to build a project, you receive the visual studio error message "fatal error C1859: header file name unexpected precompiled header, simply rerunning the compiler might fix this problem." Additionally, this issue still occurs even when you run the compiler again. This issue occurs when you enable the Create/Use Precompiled Header compiler option on a computer that is running Windows 7 or Windows Server 2008. You may encounter this issue more frequently if you enable c1859 unexpected precompiled the /analyze compiler option. Important Notes: A hotfix is intended to correct a specific problem. Apply the hotfix only to systems that are experiencing the specific problem. Installing the incorrect hotfix can cause damage to your system. If you are not sure whether the hotfix is the correct one for your system, do not install it. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix. Revision Information: Revision 2: Modified applicability to more accurately detect the existence of Visual Studio 2008 Service Pack 1 and higher.
Related Resources Related Vulnerabilities None Related Patches None Superseded Patches None IT Risk Posture: Learn More Vulnerabilities Patches Browse By Date Browse By Vendor Patch RSS Feed News Free Risk Assessment Tools Application Scanner Find vulnerabilities on your network. Device Scanner Find vulnerabilities on your network. Patch Scanner Find vulnerabilities on your network. Last Updated: 27 May 2016 11:19:55 Lumension Corporate Website Intelligence Center FREE TRIAL Contact Us Support Resources Portal Community Blog Solutions Data Protection USB Security and Data Encryption Endpoint Protection Application Whitelistin