linuxgcclocationstdioinclude-path

Where is the stdio.h file located in Linux while using the gcc.7.2 compiler?


I can't find the stdio.h file. I am using Linux Mint 18.2 XFCE and gcc-7.2 compiler.

Here is output of find . -type f -name stdio.h

smit@smit-Aspire-5742:/usr/lib/gcc$ find . -type f -name stdio.h
./i686-w64-mingw32/5.3-win32/include/ssp/stdio.h
./i686-w64-mingw32/5.3-win32/include/c++/tr1/stdio.h
./i686-w64-mingw32/5.3-posix/include/ssp/stdio.h
./i686-w64-mingw32/5.3-posix/include/c++/tr1/stdio.h
./x86_64-w64-mingw32/5.3-win32/include/ssp/stdio.h
./x86_64-w64-mingw32/5.3-win32/include/c++/tr1/stdio.h
./x86_64-w64-mingw32/5.3-posix/include/ssp/stdio.h
./x86_64-w64-mingw32/5.3-posix/include/c++/tr1/stdio.h

I don't want the mingw files. It's a cross compiler that I rarely use. I can't find gcc-7.2's stdio.h file. Am I looking in wrong directory?


Solution

  • You are looking in the wrong location. stdio.h is not located in /usr/lib/gcc but in /usr/include

    <> Is basically a shortcut to /usr/include (or any directory you specify after the -I compiler flag) in C/C++. So

    #include <myheader.h>
    

    would include /usr/include/myheader.h and

    #include <file/otherheader.h> 
    

    Would include /usr/include/file/otherheader.h This means that since you normally include stdio.h with

    #include <stdio.h>
    

    the location would be /usr/include/stdio.h