1

I have a 64 bit Cygwin on my 64 bit Win7.
I installed gcc-core and gcc-g++ packages.
I made a simple C program:

#include <stdio.h>
int main() {
  exit(0);
}

when I compile with: gcc-c test.c I got:
fatal error: stdio.h: No such file or directory

Doing it with -v flag I see:

#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include-fixed
 /usr/include
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../lib/../include/w32api
End of search list.
GNU C (GCC) version 4.8.3 (x86_64-pc-cygwin) 

The stdio.h which comes with gcc-core package is present on my pc at this location (which is fine according to Cygwin's package searcher also):
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include/ssp/stdio.h

What it means that ssp directory and why stdio.h is placed there ?
Why gcc cannot find stdio.h present at this location ?

6
  • I presume your actual source file has #include <stdio.h>, not #include &lt;stdio.h&gt;. I've fixed your question's formatting; please verify that it's still accurate. And exit requires #include <stdlib.h>, though that's not the cause of your problem. Jan 7 '15 at 16:44
  • You should add an include directory as Wumpus Q. Wumbley pointed out: this is not the file you want. Jan 7 '15 at 16:58
  • @Keith Thompson: you're right, I did the mistake while I edited the post Jan 7 '15 at 17:47
  • Meantime I did a Cygwin install on another machine and gcc worked fine. As Wumpus Q said I saw there a /usr/include/stdio.h which is missing on my machine. I also dont have string.h and stdlib.h in /usr/include/ on my machine. So something went corrupted while cygwin-devel was installed ??? The cygwin-setup reports cygwin-devel package as installed (Keep) however I have 85 files in /usr/include/ in my machine compared to 112 which I have on the other machine where works Jan 7 '15 at 17:53
  • Yes : ` cygcheck -c cygwin-devel Cygwin Package Information Package Version Status cygwin-devel 1.7.33-1 Incomplete ` Jan 7 '15 at 17:58
3

The file you found in the ssp directory is not a version of <stdio.h>. It only contains extra information about some of the functions in <stdio.h> for the stack-smash protector feature in gcc.

The actual <stdio.h> should be in /usr/include.

This line in your -v output is very interesting:

/usr/inlude

How did you get a /usr/inlude with no c?

Oops, the missing c in inlude was deleted in the edit by Keith Thompson.

So your gcc should be finding /usr/include/stdio.h if you have it. Is it there? As far as I can tell from the package file lists, it's supposed to be part of the cygwin base system (i.e. even if you haven't installed the compiler it should be there).

Are you missing any other header files? <stdlib.h> and <string.h> are good test candidates.

Here are some commands to investigate the cygwin package and whether it contains the file:

cygcheck -f /usr/include/stdio.h
cygcheck -c cygwin
cygcheck -l cygwin | grep stdio

UPDATE: so it seems I'm behind the times and there's a cygwin-devel package now. The header files aren't in the base cygwin package any more. To check the correct package on the latest cygwin, you'd use

cygcheck -c cygwin-devel

as has already been done in the comments. And since it's listed as "incomplete" the solution is probably to reinstall it using cygwin's setup program.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.