Stdio h no such file or directory linux

fatal error: _stdio.h: No such file or directory

I’m compiling a open source N-body integrator (REBOUND, find it on github) in C using a makefile that has basically always worked. The makefile compiles the code fine on the supercomputer, but has recently stopped working on my personal computer. I work on two computers, a new Macbook Pro and a slightly older iMac. Both computers have a homebrewed version of gcc 8.2.0 because the default Mac compiler lacks OpenMP. Anyway, when I try to run the makefile on my personal computer I get an error in a file included in rebound.c (the base source file for REBOUND in the src/ directory). The error says that the stdio.h file included in rebound.c is trying to include a file _stdio.h which does not exist. Now, the specific stdio.h file that is causing this error is buried deep in the 8.2.0 gcc installation in the homebrew Cellar in a directory called «include-fixed». Indeed, if I go look at this stdio.h file, it does try to include a file _stdio.h Can anyone tell me what’s happening here? I’ve never seen a proceeding underscore in the name of a header file before. I’m almost inclined to believe that this is a typo in the stdio.h file in my gcc installation? I «brew upgrade»d gcc just to make sure I had a current version and I still get this error? How do I fix this?

1 Answer 1

The intention is to load the actual system stdio.h, and “fix” the problems there. Apparently that didn’t go well. Funny enough, loading the original /usr/include/stdio.h doesn’t cause any problems, so simply removing the fixed file solves the problem.

Читайте также:  Nvidia geforce linux mint

Thanks for the help. I edited the Makefile.defs file in the REBOUND src directory to include /usr/include (it didn’t automatically do this), and that fixed the problem without needing to delete any files.

Источник

GCC fatal error: stdio.h: No such file or directory

I’m trying to compile a program in C on OS X 10.9 with GCC 4.9 (experimental). For some reason, I’m getting the following error at compile time:

gcc: fatal error: stdio.h: No such file or directory 
#include int main(int argc, const char *argv[])

Again, upon running gcc -o ~/hello ~/hello.c , I got the same error. I’m using an experimental version of gcc , but it seems implausible that there would be a release which generated errors upon importing stdio . What could be causing this issue, and how can it be fixed?

You can see where gcc is looking for header files by doing echo «#include » | gcc -v -x c — and examining the search paths.

Mavericks no longer has a base /usr/include. You need to link it into place from the XCode OS 10.9 SDK.

@user2615799 Its at sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include /usr/include

5 Answers 5

macOS

I had this problem too (encountered through Macports compilers). Previous versions of Xcode would let you install command line tools through xcode/Preferences, but xcode5 doesn’t give a command line tools option in the GUI, that so I assumed it was automatically included now. Try running this command:

If you see an error message that developer tools are already installed (and still header files can’t be found), wipe out any existing one to do a fresh installation:

sudo rm -rf /Library/Developer/CommandLineTools 

Ubuntu

sudo apt-get install libc6-dev 

Источник

Читайте также:  Резервное копирование восстановление linux

PPC cross-compile and Fatal error: stdio.h: No such file or directory

Although this is a ppc64 compiler, I can pass a flag to force 32-bit mode so for now, that does not worry me. I just want to get it compiling even in 64-bit mode. I am trying to compile the following hello world program:

When I ran this with regular gcc , it compiles and runs just fine. The problem is that when compiling I get the error mentioned above. Here is the output of the compilation command

[root@dev cross-compil-tests]# powerpc64-linux-gnu-gcc -o hello hello.c -v Using built-in specs. COLLECT_GCC=powerpc64-linux-gnu-gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/powerpc64-linux-gnu/4.8.5/lto-wrapper Target: powerpc64-linux-gnu Configured with: ../gcc-4.8.5-20150702/configure --bindir=/usr/bin --build=x86_64-redhat-linux-gnu --datadir=/usr/share --disable-decimal-float --disable-dependency-tracking --disable-gold --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-nls --disable-plugin --disable-shared --disable-silent-rules --disable-sjlj-exceptions --disable-threads --enable-checking= --enable-gnu-unique-object --enable-initfini-array --enable-languages=c,c++ --enable-linker-build-id --enable-nls --enable-obsolete --enable-targets=all --exec-prefix=/usr --host=x86_64-redhat-linux-gnu --includedir=/usr/include --infodir=/usr/share/info --libexecdir=/usr/libexec --localstatedir=/var --mandir=/usr/share/man --prefix=/usr --program-prefix=powerpc64-linux-gnu- --sbindir=/usr/sbin --sharedstatedir=/var/lib --sysconfdir=/etc --target=powerpc64-linux-gnu --with-bugurl=http://bugzilla.redhat.com/bugzilla/ --with-linker-hash-style=gnu --with-newlib --with-sysroot=/usr/powerpc64-linux-gnu/sys-root --with-system-libunwind --with-system-zlib --without-headers --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/cloog-install --with-cpu-32=power4 --with-tune-32=power6 --with-cpu-64=power4 --with-tune-64=power6 --enable-secureplt --with-long-double-128 Thread model: single gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) COLLECT_GCC_OPTIONS='-o' 'hello' '-v' '-mtune=power6' '-mcpu=power4' /usr/libexec/gcc/powerpc64-linux-gnu/4.8.5/cc1 -quiet -v -D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=linux -Asystem=unix -Asystem=posix hello.c -msecure-plt -quiet -dumpbase hello.c -mtune=power6 -mcpu=power4 -auxbase hello -version -o /tmp/ccwki2NC.s GNU C (GCC) version 4.8.5 20150623 (Red Hat 4.8.5-16) (powerpc64-linux-gnu) compiled by GNU C version 4.8.5 20150623 (Red Hat 4.8.5-11), GMP version 6.0.0, MPFR version 3.1.1, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/powerpc64-linux-gnu/sys-root/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/powerpc64-linux-gnu/4.8.5/../../../../powerpc64-linux-gnu/include" ignoring nonexistent directory "/usr/powerpc64-linux-gnu/sys-root/usr/include" #include ". " search starts here: #include search starts here: /usr/lib/gcc/powerpc64-linux-gnu/4.8.5/include /usr/lib/gcc/powerpc64-linux-gnu/4.8.5/include-fixed End of search list. GNU C (GCC) version 4.8.5 20150623 (Red Hat 4.8.5-16) (powerpc64-linux-gnu) compiled by GNU C version 4.8.5 20150623 (Red Hat 4.8.5-11), GMP version 6.0.0, MPFR version 3.1.1, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 0af58e346ee6cfd1f5beece8a365542e hello.c:1:19: fatal error: stdio.h: No such file or directory #include ^ compilation terminated. 
[. ] ignoring nonexistent directory "/usr/powerpc64-linux-gnu/sys-root/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/powerpc64-linux-gnu/4.8.5/../../../../powerpc64-linux-gnu/include" ignoring nonexistent directory "/usr/powerpc64-linux-gnu/sys-root/usr/include" [. ] hello.c:1:19: fatal error: stdio.h: No such file or directory #include

The ignoring nonexistent directory entries might be the problem. I do not know how to fix it, and have removed/reinstalled the cross-compiler multiple times. I also cannot find a C library for the cross-compiler that I can download so that I can link it manually with the -I flag. Attempted Solutions I did a:

Читайте также:  Vlc media player linux mint

and linked the directory of where I found it using -I . New error, could not find stubs-32.h . Well ok, fixed that through some more googling (simple yum install) and then I got crt1.o not found. etc. Frustrating, but I believe this was not the correct direction to go anyways. here is the ones my computer found

[root@lxdev-gab gnu]# find "stdio.h" / | grep "stdio.h" find: ‘stdio.h’: No such file or directory /usr/include/bits/stdio.h /usr/include/stdio.h /usr/include/c++/4.8.2/tr1/stdio.h /usr/share/man/man0p/stdio.h.0p.gz 

Источник

Оцените статью
Adblock
detector