15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Is not a precompiled header error

MCVICAR DAVID ugrad -- com50008@paisley.ac.uk
Wednesday, February 14, 1996

Hi,

I am writing a client server application using Visual C++ V4.0, MFC 4
and Microsoft RPC 2.0.  I am getting an error from the compiler now that
I have brought C code (automatically generated by the MIDL (MS Interface
Definition Language) compiler).  The error is

"C1853: 'DEBUG/COLLABORATE.PCH' is not a precompiled header file created
with this compiler"

The project builds all other C and C++ files but fails to compile a file
collab_s.c.  This file was part of a console based application, and
compiled with VC 4.0 then but now that it is part of the GUI application
it fails to compile.

The only alteration I have made to the project is to include an RPC
library file.

Any help will be greatly appreciated.

-- 
David A. McVicar

EMail: dmcvicar@bcs.org.uk / com50008@paisley.ac.uk
Phone - Home  : 01505 322099 - Anytime before 22:00
	Mobile: 0973 386463  - Anytime



Brad Wilson -- bradw@netnet.net
Friday, February 16, 1996

[Mini-digest: 4 responses]

> I am writing a client server application using Visual C++ V4.0, MFC 4
> and Microsoft RPC 2.0.  I am getting an error from the compiler now that
> I have brought C code (automatically generated by the MIDL (MS Interface
> Definition Language) compiler).  The error is
>
> "C1853: 'DEBUG/COLLABORATE.PCH' is not a precompiled header file created
> with this compiler"

C and C++ source code files cannot share the same precompiled header,
since the C and C++ compilers are different compilers.  In your project
settings, turn off pre-compiled header support for the .C file.

Good luck!
Brad

--
class CBradWilson : public CWorldWatchProgrammingTeam {
  public:
    void GetInetAddr  ( CString& s ) { s = "bradw@exptech.com";      }
    void GetE164Addr  ( CString& s ) { s = "+1 (810) 620-9803";      }
    void GetURL       ( CString& s ) { s = "http://www.exptech.com"; }
    void GetDisclaimer( CString& s ) { s = "All I say is fact :-p";  }
};

//  QOTW:  "Music nowadays is merely the art of executing difficulties and in
//          the end that which is only difficult ceases to please."

-----From: LeRoy Baxter 

I had that message yesterday when I tried to add a .c file to my C++ project.
Error went away when I did the following two things:
   1.  put '#include "stdafx.h"' at top of file
   2. renamed file to have .cpp extension (instead of .c)

-----From: marksi@eskimo.com (Mark Simonton)

This sounds like you changed something in a header, but tlhe build engine isn't
recognizing that it needs to rebuild it (and it's associated .obj file).  Try
deleting all the files in the DEBUG directory or choose rebuild all and see
what happens.  Sometimes the IDE gets confused.  

You could also try just deleting the .pch and associated .obj and rebuilding
and see what happens.

Q:  does the new library have an associated .h file that needs to have all or
part of itself included in the .PCH?

-----From: "Mike Blaszczak" 

> I am writing a client server application using Visual C++ V4.0, MFC 4
> and Microsoft RPC 2.0. 

Thanks.

> The error is
> "C1853: 'DEBUG/COLLABORATE.PCH' is not a precompiled
> header file created with this compiler"

There are three or four things that cause this error.  Here's what they are in 
(exponentially) decreasing order of liklihood:

1) You have run out of disk space and the PCH file is artificially truncated. 
This was a very common problem with VC++ 2.x and might have been fixed in 4.0, 
though (so that the compiler will actually say "out of disk writing PCH" 
instead of leaving a munged PCH lying around)

2) You have a PCH file lying around which was busted.  That is, you pressed 
CTRL+C while the compiler was playing with the PCH and it got corrupted... but 
that corruption isn't noticed until you compile your one file.

3) You're using on a precompiled header that was created with different 
command-line options.  I was able to do this with VC++ 2.x, but I can't 
remember having seen it with VC++ 4.0--the compiler now properly says 
something about the options being inconsistent between precompiled header 
generation and use.

4) You've found an honest compiler bug. Likely causes include including things 
before you include the PCH-referencing files... if you reorganize things 
(propbably in your one file that doesn't compile) you should be able to work 
around the problem. If that's the case, you should try to bag the sample and 
send it to Microsoft.

.B ekiM
TCHAR szBukowski[] = _T("And then, I got the hell out of there.");




| Вернуться в корень Архива |