The compiler under Linux cannot find the header file

王林
Release: 2020-01-11 16:27:35
Original
4895 people have browsed it

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
Copy after login

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
Copy after login

The result is as follows:

/usr/local/include/xxx/xxx.h
Copy after login

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
Copy after login

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!