Compiler Error C2854


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at Compiler Error C2854.

syntax error in #pragma hdrstop

The #pragma hdrstop gives an invalid filename. The pragma can be followed by an optional filename in parentheses and quotation marks:

The following sample generates C2854:

// C2854.cpp  
// compile with: /c  
#pragma hdrstop( "\\source\\pchfiles\\myheader.pch" ]   // C2854  
// try the following line instead  
// #pragma hdrstop( "\\source\\pchfiles\\myheader.pch" )