Solved

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

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

  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 …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

707 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

14 Experts available now in Live!

Get 1:1 Help Now