Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: C++
Expertise: Beginner
Jan 18, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Linking a *.c with a *.h File

As a developer new to C (I'm using Borland C/C++ version 5), I am trying to understand the method of linking *.c and *.h files within an application.

First I wrote the one.h file. Next, I wrote the one.c file and placed the #include "one.h" statement in its declarations section.

Using the Borland IDE, how do you link the files so that they can be compiled as one application?

Once you #include the header file, you simply compile the .c source file. The declarations within the header file are compiled too because the compiler considers the header as an integral part of the source file (in other words, the effect of #including a header in a source file is as if you had copied and pasted the header into the beginning of the source file). Most IDEs automatically link the resultant object file and, if all is well, you can immediately run the executable produced. Make sure your source file contains "main()".

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date