Solved

Linking C files

Posted on 2002-05-07
4
156 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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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