Linux system include files

Filesystem Hierarchy Standard

This standard consists of a set of requirements and guidelines for file and directory placement under UNIX-like operating systems. The guidelines are intended to support interoperability of applications, system administration tools, development tools, and scripts as well as greater uniformity of documentation for these systems.

All trademarks and copyrights are owned by their owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark.

Permission is granted to make and distribute verbatim copies of this standard provided the copyright and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this standard under the conditions for verbatim copying, provided also that the title page is labeled as modified including a reference to the original standard, provided that information on retrieving the original standard is included, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this standard into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the copyright holder.

Table of Contents 1. Introduction Purpose Conventions 2. The Filesystem 3. The Root Filesystem Purpose Requirements Specific Options /bin : Essential user command binaries (for use by all users) Purpose Requirements Specific Options /boot : Static files of the boot loader Purpose Specific Options /dev : Device files Purpose Specific Options /etc : Host-specific system configuration Purpose Requirements Specific Options /etc/opt : Configuration files for /opt /etc/X11 : Configuration for the X Window System (optional) /etc/sgml : Configuration files for SGML (optional) /etc/xml : Configuration files for XML (optional) /home : User home directories (optional) Purpose Requirements /lib : Essential shared libraries and kernel modules Purpose Requirements Specific Options /lib : Alternate format essential shared libraries (optional) Purpose Requirements /media : Mount point for removeable media Purpose Specific Options /mnt : Mount point for a temporarily mounted filesystem Purpose /opt : Add-on application software packages Purpose Requirements /root : Home directory for the root user (optional) Purpose /sbin : System binaries Purpose Requirements Specific Options /srv : Data for services provided by this system Purpose /tmp : Temporary files Purpose 4. The /usr Hierarchy Purpose Requirements Specific Options /usr/X11R6 : X Window System, Version 11 Release 6 (optional) Purpose Specific Options /usr/bin : Most user commands Purpose Specific Options /usr/include : Directory for standard include files. Purpose Specific Options /usr/lib : Libraries for programming and packages Purpose Specific Options /usr/lib : Alternate format libraries (optional) Purpose /usr/local : Local hierarchy /usr/local/share /usr/sbin : Non-essential standard system binaries Purpose /usr/share : Architecture-independent data Purpose Requirements Specific Options /usr/share/dict : Word lists (optional) /usr/share/man : Manual pages /usr/share/misc : Miscellaneous architecture-independent data /usr/share/sgml : SGML data (optional) /usr/share/xml : XML data (optional) /usr/src : Source code (optional) Purpose 5. The /var Hierarchy Purpose Requirements Specific Options /var/account : Process accounting logs (optional) Purpose /var/cache : Application cache data Purpose Specific Options /var/cache/fonts : Locally-generated fonts (optional) /var/cache/man : Locally-formatted manual pages (optional) /var/crash : System crash dumps (optional) Purpose /var/games : Variable game data (optional) Purpose /var/lib : Variable state information Purpose Requirements Specific Options /var/lib/ : Editor backup files and state (optional) /var/lib/hwclock : State directory for hwclock (optional) /var/lib/misc : Miscellaneous variable data /var/lock : Lock files Purpose /var/log : Log files and directories Purpose Specific Options /var/mail : User mailbox files (optional) Purpose /var/opt : Variable data for /opt Purpose /var/run : Run-time variable data Purpose Requirements /var/spool : Application spool data Purpose Specific Options /var/spool/lpd : Line-printer daemon print queues (optional) /var/spool/rwho : Rwhod files (optional) /var/tmp : Temporary files preserved between system reboots Purpose /var/yp : Network Information Service (NIS) database files (optional) Purpose 6. Operating System Specific Annex Linux / : Root directory /bin : Essential user command binaries (for use by all users) /dev : Devices and special files /etc : Host-specific system configuration /lib64 and /lib32 : 64/32-bit libraries (architecture dependent) /proc : Kernel and process information virtual filesystem /sbin : Essential system binaries /usr/include : Header files included by C programs /usr/src : Source code /var/spool/cron : cron and at jobs 7. Appendix The FHS mailing list Background of the FHS General Guidelines Scope Acknowledgments Contributors

Читайте также:  Как устанавливать linux virtualbox

Chapter 1. Introduction

Purpose

Software to predict the location of installed files and directories, and

Users to predict the location of installed files and directories.

Источник

Where are include files stored — Ubuntu Linux, GCC

the compiler, GCC in my case, knows where that stdio.h (and even the object file) are located on my hard drive. It just utilizes the files with no interaction from me. I think that on my Ubuntu Linux machine the files are stored at /usr/include/ . How does the compiler know where to look for these files? Is this configurable or is this just the expected default? Where would I look for this configuration? Since I’m asking a question on these include files, what are the source of the files? I know this might be fuzzy in the Linux community but who manages these? Who would provide and manage the same files for a Windows compiler. I was always under the impression that they come with the compiler but that was an assumption.

4 Answers 4

When the include file is in brackets the preprocessor first searches in paths specified via the -I flag. Then it searches the standard include paths (see the above link, and use the -v flag to test on your system).

When the include file is in quotes the preprocessor first searches in the current directory, then paths specified by -iquote, then -I paths, then the standard paths.

-nostdinc can be used to prevent the preprocessor from searching the standard paths at all.

Environment variables can also be used to add search paths.

Читайте также:  Как открыть wine на linux

When compiling if you use the -v flag you can see the search paths used.

gcc is a rich and complex «orchestrating» program that calls many other programs to perform its duties. For the specific purpose of seeing where #include «goo» and #include will search on your system, I recommend:

$ touch a.c $ gcc -v -E a.c . #include ". " search starts here: #include search starts here: /usr/local/include /usr/lib/gcc/i686-apple-darwin9/4.0.1/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. # 1 "a.c" 

This is one way to see the search lists for included files, including (if any) directories into which #include «. » will look but #include <. >won’t. This specific list I’m showing is actually on Mac OS X (aka Darwin) but the commands I recommend will show you the search lists (as well as interesting configuration details that I’ve replaced with . here;-) on any system on which gcc runs properly.

Источник

Оцените статью
Adblock
detector