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

x
?
Solved

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

Posted on 1999-01-14
3
Medium Priority
?
304 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 200 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

Technology Partners: 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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

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