Beginner’s Question C & C++?…?
Posted On April 11, 2011
Question by Kuldeep Sharma: Beginner’s Question C & C++?…?
I have query how to include file in Dev C++. I created a file.
File Name :: microsoft.c
#define MICROSOFT printf (“\n\nI Founded Microsoft Corporation”);
printf (“\n\nHi, My Name Is Bill Gates”);
I placed this file into path “D:\Dev-Cpp\include” & Now I created Another file::
printf (“\n\nYes We Got This”);
Now It’s not working I have a program that demands about 25 function i want place them in different file so than with the help of include i can create more efficient application.
Please Don’t Hesitate To Give Long Answers…..
Thanks A Lot…………
Answer by MadBill
I don’t know your particular C compiler, but inevitably it should allow you to create MULTIPLE C-source files all belonging to one ‘project’. You should find something in your development environment which allows you to specify the source files “included in” (or better said “belonging to”) your project (that’s NOT done by #include – which is only for header (.h) files…..)
If you choose, you should ALSO be able to individually compile all of your separate source files into .obj files and LINK them with the final “main” program source (which saves rebuild / compile time) to create your final execuatble. ALSO, once all these individual object files are created, you could make a library out of them to link to the main program at build time.
Add your own answer in the comments!