Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Linking C files

Posted on 2002-05-07
4
Medium Priority
?
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 150 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

618 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