Refer to the header file search path under Linux
“header.h”
#include "header.h"
When the same file exists in each directory, first find which one to use. The loading sequence is as follows:
-
Current directory
-
The directory specified by the parameter -I when gcc is compiled
-
Environment variable C_INCLUDE_PATH (C++ uses CPLUS_INCLUDE_PATH)
-
System default directory
- /usr/include
- /usr/local/include
- /usr/include/x86_64-linux-gnu
<header.h>
#include <header.h>
When the same file exists in each directory, first find which one to use. But the current directory will not be searched !
-
The directory specified by the parameter -I when gcc is compiled
-
Environment variable C_INCLUDE_PATH (C++ uses CPLUS_INCLUDE_PATH)
-
System default directory
- /usr/include
- /usr/local/include
- /usr/include/x86_64-linux-gnu
You can view the LIBRARY_PATH and INCLUDE paths of gcc through the following command
echo 'main(){}' | gcc -E -v -