Page 1 of 1

stdio.h: No such file or directory.

Posted: Sat Sep 08, 2012 6:02 pm
by D.E.L.B.
I tried compiling a program with gcc, and this error came up, what's wrong? I am using the Raspbian OS, does Raspbian not have GCC?

Re: stdio.h: No such file or directory.

Posted: Sat Sep 08, 2012 7:04 pm
by PeterO
If you post an example .c file that produces this error, and the gcc command lines you used, then someone might be able to help.
PeterO

Re: stdio.h: No such file or directory.

Posted: Sat Sep 08, 2012 7:45 pm
by D.E.L.B.
I used this command in the LX Terminal:
gcc -o arrays_one.c arrays_one.c

Then I used this program:

Code: Select all

#include <stdio.h> int main()
{
/* Create an array with four element and assign values. */
float fourVector[4]={1.0, 2.0, 0.5, 2.292};
/* Print the number of elements in the array. */
printf("There are %ld elements\n",sizeof(fourVector)/sizeof(float)); printf("fourVector[3]=%f\n",fourVector[3]); /* Print the fourth element.*/ return 0; /* Return success to the operating system. */
}
I know you're suppose to put indents in the brackets :).

Re: stdio.h: No such file or directory.

Posted: Sat Sep 08, 2012 8:08 pm
by PeterO
Command should be

gcc -o arrays_one arrays_one.c

But the code you've pasted is not a valid C program!

tt.c:1:20: warning: extra tokens at end of #include directive [enabled by default]
tt.c:2:1: error: expected identifier or ‘(’ before ‘{’ token

You can't put anything after the ">" of a #include line.....

However it doesn't fail with your original error.....

what output do you get fro gcc if you add "-v" switch ?

PeterO

Re: stdio.h: No such file or directory.

Posted: Sat Sep 08, 2012 10:14 pm
by D.E.L.B.

Code: Select all

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-8+rpi1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-8+rpi1)

Re: stdio.h: No such file or directory.

Posted: Sun Sep 09, 2012 7:13 am
by PeterO
When I wrote "add the -v switch" I meant to the existing command

gcc -v -o arrays_one arrays_one.c

PeterO

Re: stdio.h: No such file or directory.

Posted: Sun Sep 09, 2012 10:26 pm
by D.E.L.B.

Code: Select all

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-8+rpi1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-8+rpi1)
COLLECT_GCC_OPTIONS='-v' '-v' '-march=armv6' '-mfloat-abi=hard' '-mfpu=vfp'
 /usr/lib/gcc/arm-linux-gnueabihf/4.6/cc1 -quiet -v -v -imultilib . -imultiarch arm-linux-gnueabihf arrays_one.c -quiet -dumpbase arrays_one.c -march=armv6 -mfloat-abi=hard -mfpu=vfp -auxbase arrays_one -version -o /tmp/ccHFOPbe.s
GNU C (Debian 4.6.3-8+rpi1) version 4.6.3 (arm-linux-gnueabihf)
        compiled by GNU C version 4.6.3, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=42 --param ggc-min-heapsize=23514
ignoring nonexistent directory "/usr/local/include/arm-linux-gnueabihf"
ignoring nonexistent directory "/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/arm-linux-gnueabihf/4.6/include
 /usr/local/include
 /usr/lib/gcc/arm-linux-gnueabihf/4.6/include-fixed
 /usr/include/arm-linux-gnueabihf
 /usr/include
End of search list.
GNU C (Debian 4.6.3-8+rpi1) version 4.6.3 (arm-linux-gnueabihf)
        compiled by GNU C version 4.6.3, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=42 --param ggc-min-heapsize=23514
Compiler executable checksum: 3c5b59c0ef1fec28e05e457a89f35c2f
arrays_one.c:1:20: fatal error: stdio. h: No such file or directory
compilation terminated.
COLLECT_GCC_OPTIONS='-v' '-v' '-march=armv6' '-mfloat-abi=hard' '-mfpu=vfp'
 /usr/lib/gcc/arm-linux-gnueabihf/4.6/cc1 -quiet -v -v -imultilib . -imultiarch arm-linux-gnueabihf arrays_one.c -quiet -dumpbase arrays_one.c -march=armv6 -mfloat-abi=hard -mfpu=vfp -auxbase arrays_one -version -o /tmp/ccHFOPbe.s
GNU C (Debian 4.6.3-8+rpi1) version 4.6.3 (arm-linux-gnueabihf)
        compiled by GNU C version 4.6.3, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=42 --param ggc-min-heapsize=23514
ignoring nonexistent directory "/usr/local/include/arm-linux-gnueabihf"
ignoring nonexistent directory "/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/arm-linux-gnueabihf/4.6/include
 /usr/local/include
 /usr/lib/gcc/arm-linux-gnueabihf/4.6/include-fixed
 /usr/include/arm-linux-gnueabihf
 /usr/include
End of search list.
GNU C (Debian 4.6.3-8+rpi1) version 4.6.3 (arm-linux-gnueabihf)
        compiled by GNU C version 4.6.3, GMP version 5.0.5, MPFR version 3.1.0-p10, MPC version 0.9
GGC heuristics: --param ggc-min-expand=42 --param ggc-min-heapsize=23514
Compiler executable checksum: 3c5b59c0ef1fec28e05e457a89f35c2f
arrays_one.c:1:20: fatal error: stdio. h: No such file or directory
compilation terminated.

Re: stdio.h: No such file or directory.

Posted: Sun Sep 09, 2012 11:46 pm
by panik
D.E.L.B. wrote:

Code: Select all

[...snip...]
arrays_one.c:1:20: fatal error: stdio. h: No such file or directory
compilation terminated.
Is that a ' ' (space) between the '.' and the 'h'?
The first line of your code should be:

Code: Select all

#include <stdio.h>
With nothing behind it and no spaces between the <>.

Re: stdio.h: No such file or directory.

Posted: Mon Sep 10, 2012 8:54 am
by PeterO
panik wrote:

Code: Select all

#include <stdio.h>
With nothing behind it and no spaces between the <>.
Yeah that caught my eye as well,. but there was no space there in the code that he posted earlier!
PeterO

Re: stdio.h: No such file or directory.

Posted: Tue Sep 11, 2012 12:24 am
by D.E.L.B.
Not quite sure what I've done by there, ah well. Yes removing the space by the full stop in the <stdio.h> tag fixed it.

Thanks.

Re: stdio.h: No such file or directory.

Posted: Tue Sep 11, 2012 9:17 am
by PeterO
D'OH !!!

A minor point of terminology.... Although stdio.h is enclosed in angle brackets "< >" is is NOT called a tag. Tags are found in html,xml etc files.

Also you will come across #include lines that don't use angle brackets but use normal double quotes.

#include <math.h>
#include "localIncludeFile.h"

In this example the file called math.h is searched for along the list of directories (this list is for my desktop machine NOT my pi)
/usr/lib/gcc/i686-redhat-linux/4.6.3/include
/usr/local/include
/usr/include

You can temporarily add to this list by using "-I /path/to/directory/" switch on the gcc command.

The file localIncludeFIle.h will only be looked for in the current directory (normally the one where the .c file is located).

HTH
PeterO