Solved

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

Posted on 1999-01-14
3
298 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
  • 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

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

Suggested Solutions

Title # Comments Views Activity
Quicksort a dynamic deque 33 79
C++ BOOL WINAPI ReadFile fails on windows 10 when reading from USB cable 9 511
Add values of each row in an array 3 70
C++ Code Issue 4 37
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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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.

713 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