Home>Article>Operation and Maintenance> The compiler under Linux cannot find the header file

The compiler under Linux cannot find the header file

王林
王林 Original
2020-01-11 16:27:35 4984browse

The compiler under Linux cannot find the header file

The problem arises:

If the header file cannot be found when compiling the program on Linux, the following error will be prompted:

$ gcc test.c -o test test.c:9:16: fatal error: xxx.h: No such file or directory #include

The following description takes the Ubuntu system as an example.

(Free video tutorial sharing:linux video tutorial)

The solution is as follows:

1. First find the path where xxx.h is located

The command is as follows:

$ sudo find / -name xxx.h

The result is as follows:

/usr/local/include/xxx/xxx.h

2. Then use the -I option to add the directory to compile

The command is as follows:

$ gcc test.c -o test -I /usr/local/include/xxx

Recommended related articles and tutorials:linux video tutorial

The above is the detailed content of The compiler under Linux cannot find the header file. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn