Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The header files only include the definition of the functions that you would use in a file where the header file is being <em>included</em>.</p> <p>Library files comprise the actual implementation of the functions that you will be using in your program.</p> <p>The header file is included (copy/pasted) during the preprocessing stage and is compiled as part of the program being written during compilation phase. One has to specify the -lpthread in the command line, so that the linker will know which <em>library</em> to look into for functions used in the program.</p> <p>Similar Question/Answer on Stackoverflow explaining it in layman terms:</p> <p><a href="https://stackoverflow.com/questions/924485/whats-the-difference-between-a-header-file-and-a-library">What&#39;s the difference between a header file and a library?</a></p> <p><strong>Part 2</strong>: Why we do not have to <em>always</em> include library files when we have <code>#include</code>?</p> <p>This might be the case when:</p> <blockquote> <p>i. The implementation of the functions is included in the header file. </p> <p>ii. The implementation of the functions is in <code>c</code> files for which you have the source available. </p> <p>iii. The required libraries are <a href="http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html" rel="nofollow noreferrer">included by your compiler by default</a> e.g., standard c libraries.</p> </blockquote> <p><strong>NOTE</strong>: Here is a reference to <a href="http://www.cplusplus.com/reference/" rel="nofollow noreferrer">what is included in the standard C library</a>, which is included by default by many compilers.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload