Solved

How to port c to c++(MFC)?

Posted on 1999-01-14
3
301 Views
Last Modified: 2008-02-20
I created a MFC application, but now i need to reuse some function that i previously done in c. What should i do if i want to include the previous *.c files.

E.g.
I have included aaa.c and aaa.h into my MFC workspace. In the aaa.h i use extern "C" to cover the prototype of my c function in aaa.c.

When i build the exe, it returns me an error code i.e.
"Fatal Error C1010: unexpected end of file while looking for  precompiled header directive". This error message comes out when the compiler try to compile aaa.c.

I already check the help file regarding this message, unfortunately i don't understand what it try to say, and i also cann't find any solution to solve this problem.

Please help!


0
Comment
Question by:softyan
[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
3 Comments
 

Author Comment

by:softyan
ID: 1182225
Edited text of question
0
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 1182226
You simply have to use '#include <stdafx.h>' in your C files - the other alternative is to turn off the usage of precomoiled headers. As VC++ assumes that there has to be an #include directive f9or stdafx.h by default, these are the 2 ways to get around this (see the project settings for 'precompiled headers' on the C+ tab on the 'Project Settings...' dialog)
0
 
LVL 86

Expert Comment

by:jkr
ID: 1182227
sorry - 'precomoiled' should of course read ' precompiled' ;-)
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

695 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