Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

header files inclusion in linux

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
how do i include header files while writing c programs under linux?iam not able to include any header file except stdio.h.i get compilation error if i include.i think there is something we must include while compiling.can anyone give me clear idea?
 
hey!
which include files u would like to include if they are created by u then add option -I/ur/directory/name at the time of compilation or else u let me know the files u r including...
 
i want to include header files like conio.h,math.h
i didn't undersatnd what u said
 
I am sure you have an answer by now but if not, here is a comment from 'Beginners 'c' ...

Standard header files (those supplied by your 'c' compiler vendor) are placed into '/usr/include' and in folders below that one. These are referenced in your 'c' program by placing '<>' around them. This means that <stdio.h> will be searched for in '/usr/include' Standard files in folders below '/usr/include' must include the path prefix. An example of this would be '<sys/ipc.h>'

Non-standard header files, those created by you or supplied by a third party, can be located just about anywhere. In your 'c' program, these are referred to with '&quot;&quot;' around them. Because they are not limited to where they are located, it is common practice to put the full pathname within the quotes ie, &quot;/usr/myfolder/myproject/myheader.h&quot;. The exception to this is if the header file is located in the same folder you are in when you start the compile.

Finally, 'Makefiles' and the 'c' compiler allow you to provide search paths (-I option) to any non-standard header file locations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top