Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MinGW "stdio.h : No such file or directory"

I am trying to use MinGW to compile a C program under Windows XP. The gcc.exe gives the following error:

stdio.h : No such file or directory

The code (hello.c) looks like this:

#include < stdio.h >

void main()
{
    printf("\nHello World\n");
}

I use a batch file to call gcc. The batch file looks like this:

@echo off
set OLDPATH=%PATH%
set path=C:\devtools\MinGW\bin;%PATH%
set LIBRARY_PATH=C:\devtools\MinGW\lib
set C_INCLUDE_PATH=C:\devtools\MinGW\include

gcc.exe hello.c 

set path=%OLDPATH%

I have tried the option -I without effect. What do I do wrong?

like image 910
Benno Richters Avatar asked Sep 17 '08 10:09

Benno Richters


2 Answers

Try changing the first line to:

#include <stdio.h>

without the spaces. It is trying to look for a file called " stdio.h " with a space at the beginning and end.

like image 185
Leigh Caldwell Avatar answered Oct 27 '22 14:10

Leigh Caldwell


You should try to install MinGW in the default install directory (i.e. C:\MinGW) I read many times it was recommended to avoid problems. There may be a (wrongly) hardcoded path in gcc.

like image 23
PierreBdR Avatar answered Oct 27 '22 12:10

PierreBdR