Solved

Linking C files

Posted on 2002-05-07
4
154 Views
Last Modified: 2013-11-20
I tried disabling the precompiled headers as advised but now I get the following fatal error in my C
files:
"MFC requires C++ compilation (use a .cpp suffix)"
Any idea how to solve this?
Thanks!
---------------------------------------------------------
Hi

I have a problem with linking my user application created using Microsoft Visual C++ version 6.0 to my files written in C.
I have included the "stdafx.h" file in my C source files but I still get the fatal error message saying the precompiled header file "Debug/projectname.pch" is not compatible with this version's precompiler. These error messages occur in my C files.
I tried deleting the pch file and recompiling but it still doesn't work.
Can someone advise on this?
Thanks!
0
Comment
Question by:kraa
  • 2
4 Comments
 
LVL 31

Expert Comment

by:Zoppo
ID: 6993461
Hi kraa,

take a look at:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q126717

there your problem and possible solutions are described.

hope that helps,

ZOPPO
0
 

Author Comment

by:kraa
ID: 6993520
I tried disabling the precompiled headers as advised but now I get the following fatal error in my C files:
"MFC requires C++ compilation (use a .cpp suffix)"
Any idea how to solve this?
Thanks!
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 50 total points
ID: 6993582
You shouldn't include "stdafx.h" to your .c files ... the error comes from AFX.H
which is included from AFXWIN.H which is include from STDAFX.H ... this AFX.H
declares a lot of common classes (i.e. CString) which of course cannot be compiled
by a C-compiler.
0
 
LVL 16

Expert Comment

by:AlexNek
ID: 6994622
2 kraa
Let's try rename your *.c files to *.cpp.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now