DEV Community

A Curious Learner
A Curious Learner

Posted on

Solve the error "header files not found. no such file or directory".

When we write a C/C++ program, we often need to use third-party header files (that is, unofficial header files different from stdio.h).
We need to use #include to include the header files to be used, and then compile the program. If the compiler displays an error message: header files not found. no such file or directory, how to solve this error?

header files not found

Since the compiler tells us it can't find the file, we need to know where the compiler looks for the header file.
The compiler will first look for the header file in the folder where the source program is located. If there is no header file in this folder, the compiler will look for it in the default include folder (the default include folder is usually near the folder where the compiler program is located).
If the compiler still cannot find the header file in the include folder, then you need to manually set the path of the header file so that the compiler can find the header file according to the path.

Top comments (0)