Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Actually i am having a C project,whose code i want to use(by making copy of .c&.h) inside a MFC application.So can any one tell me where to put the .c&.h files or i need any more file to make copy or how to use the code in any other way.

Sorry for inappropriate english..and thanks in advance...
Posted
Updated 18-Jan-12 19:31pm
v2
Comments
Sergey Alexandrovich Kryukov 19-Jan-12 1:28am    
What's the problem?
--SA

You can freely mix C and C++ files in the project. Place C header files where you place other header files, and place C files where you place your C++ files, or create separate directories.

It all is controlled through #include (sigh… I cannot believe it, such an archaic technique in XXI century!) anyway, so just take care of proper include paths and makes sure C and C++ are added to the project, make file and the like — further detail depend on your platform, C/C++ development system and environment.

—SA
 
Share this answer
 
You can directly add them to your MFC solution and use the necessary C functions.

Say suppose you are having Function_1() in C1.h and its definition in C1.c and if you want to use this in MyView.cpp (a cpp in your MFC app)
1. then add C1.h and C1.c to your MFC solution and
2. #include C1.h in MyView.cpp and
3. use Function_1() in necessary MyView member function

Hope I am clear to you!!!
 
Share this answer
 

  1. add a library project to your solution
  2. include the files to that project
  3. compile all
  4. access the h files in your code
  5. compile and link all
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900