DOCUMENT:Q115707 15-FEB-2002 [visualc] TITLE :FIX: C2857 Error Incorrectly Generated Using /Yc Option PRODUCT :Microsoft C Compiler PROD/VER::1.0,1.5,2.0,4.0,6.0,7.0 OPER/SYS: KEYWORDS:kbCompiler kbCPPonly kbVC kbVC410fix ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft C/C++ Compiler (CL.EXE), included with: - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++, versions 1.0, 1.5 - Microsoft Visual C++, 32-bit Editions, versions 1.0, 2.0, 4.0, 6.0 ------------------------------------------------------------------------------- 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 : kbCompiler kbCPPonly kbVC kbVC410fix Technology : kbVCsearch kbAudDeveloper kbCVCComp Version : :1.0,1.5,2.0,4.0,6.0,7.0 Issue type : kbbug Solution Type : kbfix ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2002.