Microsoft KB Archive/115707

= FIX: C2857 Error Incorrectly Generated Using /Yc Option =

Article ID: 115707

Article Last Modified on 7/5/2005

-

APPLIES TO


 * Microsoft C/C++ Professional Development System 7.0
 * Microsoft Visual C++ 1.0 Professional Edition
 * Microsoft Visual C++ 1.5 Professional Edition
 * Microsoft Visual C++ 1.0 Professional Edition
 * Microsoft Visual C++ 2.0 Professional Edition
 * Microsoft Visual C++ 4.0 Standard Edition
 * Microsoft Visual C++ 6.0 Service Pack 5

-



This article was previously published under Q115707



SYMPTOMS
If the /Yc option is used to create a precompiled header from a header file which contains a syntax error, as shown in the code below, the compiler will incorrectly generate the following error:

 error C2857: '#include' statement specified with the /Yctest.h               command line option was not found in the source file

This error is generated after the header file syntax errors are listed and after all lines of the source file have been processed.



RESOLUTION
Correct the syntax errors contained in the header file.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed above. This bug was corrected in Visual C++ version 4.1.



MORE INFORMATION
The following code can be used to demonstrate this problem.

Sample Code
/* Compile options needed: /Yctest.h /c */

TEST.H --

x int; /* This file is intentionally given an error */ /* to demonstrate the problem in the article */

TEST.CPP

#include "test.h"

void main(void) {  }

Additional query words: kbVC400bug 8.00 8.00c 9.00

Keywords: kbbug kbfix kbvc410fix kbcpponly kbcompiler KB115707

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.