For example, if I have created a library, libcommon, which uses some other custom, but widely used library in a specific field (some_other), like this:libcommon.h#ifndef LIBCOMMON_H#define LIBCOMMON_H#include some_other.hvoid do_something1();void do_something2();#endif  /* LIBCOMMON_H */Then if I want to use the library, and I have something like this in my main.c#include libcommon.hint main() {    do_something1();    do_something2();}Then in my project I get fatal error C1083: Cannot open include file: 'some_other.h': No such file or directory.Now I can fix this by providing the include path to some_other.h in my project, but I would prefer to make life easier for users of libcommon.  How do I do that?I assume I need to make sure I do not use any types or functions defined in some_other.h for this to work?  Is that a common approach?  Or is it quite often the case that for say a helper library that uses a standard other library, same some_other library, then making the user of your lib set up include paths for some_other headers is ok?I am trying to get an idea of how other people solve this issue and good approaches.
If I #include a file, do I need to have a valid path to any headers #included in the included file
c;coding standards;headers
If libcommon.h cannot be compiled without some_other.h, then anyone who wants to compile a call to doSomething1() is going to have to #include some_other.h as well as libcommon.h, otherwise the compiler simply doesn't have enough information to do its job. There's no magical way around that. As others have pointed out, when this dependency is correct you usually do something like set your build tools to look at all the .h files in a special include directory so you don't have to list each one individually on the command line.The real question you should be asking is whether libcommon.h needs to depend on some_other.h, or if it's only libcommon.c that cares about what's in some_other.h. A function signature like void do_something1() doesn't require any special information to compile, so in your toy example you should be able to simply move the #include some_other.h statement into the .c file. If your real function signatures rely on type definitions in some_other.h, you might be out of luck, or this might be a reason to consider changing those function signatures.Note that all users of libcommon still have to link against some_other's object code at link time no matter what, but because of how static linking works, it's likely that your libcommon.o includes the some_other object code, so there may not be any equivalent nuisance there. If you need more help with the linking stuff, that should be a separate question.