Home>Article>Operation and Maintenance> 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!