BestTechie Forums: My First Program - BestTechie Forums

Jump to content

  • (2 Pages) +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

My First Program


#16 User is offline   jcl 

  • UberTechie
  • Group: Linux Experts
  • Posts: 1304
  • Joined: 30-August 04
  • Location:The Internet
  • Operating System:Arch

Posted 20 January 2005 - 05:06 AM

MistaMatt90, on Jan 19 2005, 03:22 PM, said:

Hi jcl, thanks for all the info  :)  Got another question, you said the #include finds a file, and puts it in the source code.  where did that file come from?  on my hard drove somewhere?

Yes, almost certainly. Usually the compiler has a list of directories that are searched for #include'd files. The headers you used (header is the common term for files intended for #inclusion) probably came with your compiler and are stored with it, possibly in a directory named "include" (a old convention). Your compiler will have an option to add additional directories and maybe an option to display the search list.

Since we're talking about it, the difference between
#include <file>

and
#include "file"

is that most compilers respond to the latter by first searching the directory containing the file being compiled. Otherwise they're the same.

Oh, and strictly speaking the compiler can interpret #include any way it wants as long as the effect is the same. In particular, the standard headers (the headers defined by the ISO standard) are magical and don't have to exist at all. For example, it's entirely possible that
#include <cstdlib>

will actually use the C header named "stdlib.h" from whatever C compiler is handy. If you go looking for the headers don't be surprised if you don't find them right away.

This post has been edited by jcl: 20 January 2005 - 05:09 AM


  • (2 Pages) +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users