CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Why this Error?

  1. #1
    Join Date
    Apr 1999
    Posts
    18

    Why this Error?

    First I have a Project in vc60,it uses MFC,it works well,but later I add some .c or .h files (not use MFC) into the project,when compile,it's response:

    -------------------Configuration: Search - Win32 Debug--------------------
    Compiling...
    En.c
    d:\yj\httpsource\search\src\en.c(1) : fatal error C1853: 'Debug/Search.pch' is not a precompiled header file created with this compiler
    head.c
    d:\yj\httpsource\search\src\head.c(1) : fatal error C1853: 'Debug/Search.pch' is not a precompiled header file created with this compiler
    Hz.c
    d:\yj\httpsource\search\src\hz.c(1) : fatal error C1853: 'Debug/Search.pch' is not a precompiled header file created with this compiler
    inverse.c
    d:\yj\httpsource\search\src\inverse.c(1) : fatal error C1853: 'Debug/Search.pch' is not a precompiled header file created with this compiler
    keytab.c
    d:\yj\httpsource\search\src\keytab.c(1) : fatal error C1853: 'Debug/Search.pch' is not a precompiled header file created with this compiler
    std.c
    d:\yj\httpsource\search\src\std.c(1) : fatal error C1853: 'Debug/Search.pch' is not a precompiled header file created with this compiler
    Generating Code...
    Error executing cl.exe.

    Search.exe - 6 error(s), 0 warning(s)

    Why? How to solve?
    Please Help me!



  2. #2
    Join Date
    May 1999
    Posts
    11

    Re: Why this Error?

    You must set a precompiled header file for these
    *.c and *.h files,From the Project menu,select
    "Setting",select"stdafx.h" as a precompiled file
    for these *.h,*.c files.


  3. #3
    Join Date
    Apr 1999
    Posts
    6

    Re: Why this Error?

    just simply add
    #include "stdafx.h"


    for those files


  4. #4
    Join Date
    Jun 2002
    Location
    Madrid - Spain
    Posts
    28

    Re: Why this Error?

    The cause for your problem is this:

    The compiler attempts to use a precompiled header generated by a C++ compiler on a C source file. This can happen when "Per-File Use of Precompiled Headers" is used with both C and C++ source code in a project.

    It is not valid to use a C++ compiler created precompiled header with a source file that is to be compiled by the C compiler. Nor is it valid to use a C compiler created precompiled header with a source file that is to be compiled by the C++ compiler.

    To solve it, please follow these steps:

    1. For the current target, open the Project Settings dialog box and select the Precompiled Headers section under the C/C++ Tab.
    2. Select each C file from the project tree in the left pane.
    3. Select the Not using precompiled headers option button.
    4. Save the new settings and build the project.

    You can read further about this problem here:
    http://support.microsoft.com/?scid=k...6717&x=14&y=16

    Best regards,

    Ricardo Vázquez.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured