using .c files in mfc  
Author Message
Rachit





PostPosted: Sun Jun 06 23:57:21 CDT 2004 Top

MFC >> using .c files in mfc

how can i use my existing .c file as a function in mfc without retyping the whole code in mfc format. is this even possible? i have tried adding it to the project and #include-ing it but it doesn't seem to work... please help.:) thanks

Visual Studio242  
 
 
Relvinian





PostPosted: Sun Jun 06 23:57:21 CDT 2004 Top

MFC >> using .c files in mfc What function are you trying to call?

How is it prototyped in your cpp file or header?

Example of using a 'c' function in a 'cpp' world.

myheader.h
------------
#if defined(__cplusplus)
extern "C" {
#endif

bool myFunction(void* param1);

#if defined(__cplusplus)
}
#endif

Now, anywhere in your .cpp files that you would need to call myFunction,
just include the header file and you'll have proper access.

Remember, when mixing c and cpp functions, you need to let the compiler know
you want to include a 'c' type function in a 'cpp' world.

Relv



> how can i use my existing .c file as a function in mfc without retyping
the whole code in mfc format. is this even possible? i have tried adding it
to the project and #include-ing it but it doesn't seem to work... please
help.:) thanks


 
 
Joseph





PostPosted: Sun Jun 06 23:58:38 CDT 2004 Top

MFC >> using .c files in mfc I have no idea what "mfc format" means. If you have a .c file, you add it to your project.
#include is not relevant. The only issue about #include is either you must add
#include "stdafx.h"
at the start, or go into Project | Settings, select the file, select All Configurations,
C/C++ tab, Precompiled Headers, check "Do not use precompiled headers"

There is no such thing as "mfc format"
joe



>how can i use my existing .c file as a function in mfc without retyping the whole code in mfc format. is this even possible? i have tried adding it to the project and #include-ing it but it doesn't seem to work... please help.:) thanks

Joseph M. Newcomer [MVP]

Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm