Solved

Linking C files

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

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 30

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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 discusses moving either the default database or any database to a new volume.

743 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

13 Experts available now in Live!

Get 1:1 Help Now