2

I am trying to compile a hello world code using MingW tool chain:

#include <stdio.h>
#include <stdlib.h>

int main(void) {
    puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
    return EXIT_SUCCESS;
}

but I get this error message:

fatal error: stdio.h: No such file or directory helloC.c    /helloC/src line 11 

I searched for stdio.h file in my MinGW installation folder (C:\MinGW) and I find two copies in these folders:

C:\MinGW\lib\gcc\mingw32\4.6.1\include\ssp  (Related to Stack Smashing Protection)
C:\MinGW\lib\gcc\mingw32\4.6.1\include\c++\tr1 

I am using Eclipse CDT and non of these folders are in default include directories for Eclipse. I am using a 64 bit system, Windows 7.

My assumption is I need to have a third copy of stdio.h in this folder:

C:\MinGW\lib\gcc\mingw32\4.6.1\include

Am I missing a MinGW package needed to be installed for standard C library or do I need to add either ssp or tr1 folder to include search path?

Kamyar Souri
  • 1,871
  • 19
  • 29

1 Answers1

-1

try to remove #include stdlib.h and see what happens. i don't think stdio.h and stdlib.h can both work together in this context. hope it helps!

  • This code compiles with no problem on visual studio. Removing the stdlib does not help. – Kamyar Souri Dec 03 '11 at 03:03
  • I made an experiment ti install MinGW on a Windows XP 32 system and it installs the stdio.h in include folder. The same hello world program compiles with no problem. Now I need to find out the root cause of different behavior of MinGW installer on Windows 7/64 bit. – Kamyar Souri Dec 03 '11 at 18:55