Is there an easy way to find out which header file a C function declaration is in?
/usr/include and running (
grep -E 'system.*\(' *.h -R) works with some trial and error, but isn't there an easier way to do this?
If you search in the header files on your system, you'll find in what header file the function is declared on your system. It may be difficult as sometimes the function is declared via a complex macro. And it'll only tell you what header file declares the function on your system; this may even be a header file that you can't include directly because it needs other headers to come first.
The only safe way to find what header file to include is to consult the documentation of the library that provides the function. For the standard library, you can consult: