Beginner’s Question C & C++?…?

Question by Kuldeep Sharma: Beginner’s Question C & C++?…?
Dear All,

I have query how to include file in Dev C++. I created a file.

File Name :: microsoft.c
——————————
#include
#include
#define MICROSOFT printf (“\n\nI Founded Microsoft Corporation”);
main()
{
printf (“\n\nHi, My Name Is Bill Gates”);
MICROSOFT
getch();
}
—————————
I placed this file into path “D:\Dev-Cpp\include” & Now I created Another file::
—————————
#include
#include
#include
main()
{
printf (“\n\nYes We Got This”);
getch();
}

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…………

Best answer:

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!

Add a Comment

Your email address will not be published. Required fields are marked *