Linux include search path

Turn https://blog.csdn.net/wqwqh/article/details/80818149

 

1.include <header name> and include "header file name"

如:include<stdio.h>和include"stdio.h"

The former (using <>), to refer to the stdio.h file is first retrieve the standard path, to see whether there are these folders under the header file; if not, it will not retrieve the path of the current file and error.

The latter (using the ""), to refer to the file stdio.h, it is the first current path to retrieve the file; if not, then retrieve the standard path, to see whether there are these folders under the header files.

Under 2.linux, the above criteria has path: / usr / include, / usr / local / include.

3. <sys / header file name>. The <sys / io.h>, <net / ethernet.h> like. Wherein the foregoing character string (e.g., sys, net) represents the file folder name in the standard path, the string (e.g. io.h, ethernet.h), represents a header file of the files in the folder path linux standard name, such as sys folder io.h file that we can find io.h files in / usr / include / sys directory.

linux profound, need to slowly accumulate.

4. If you want to retrieve the header files in the specified path, you can add the option -I. If there header file local1.h under my / home / Desktop directory, when you compile test.c file contains local1.h, can be used: gcc test.c -o test -I / root / Desktop.

Guess you like

Origin www.cnblogs.com/xia-dong/p/11491913.html