Wednesday, 13 May 2009

gcc fails to find header files

Because I have clearly been neglecting the guts of my gcc installation too much recently (oh happy respite from commandline errors!), my computer decided to throw a wobbly about compiling a C program that included (amongst other friends) io.h, conio.h and dir.h.
A simple "hello world" program would compile when including stdio.h but not when I added io.h, screaming:
error: io.h: No such file or directory
I thought gcc would search /usr/include/sys automatically, but it appears not. I have to tell it on the command line:
gcc -o andorsif andorsif.c -I /usr/include/sys -L /usr/include/sys
After I cleared up that heap of doodoo then I still get errors from the program that look like:
error: ‘MAXPATH’ was not declared in this scope
but replacing incidences of MAXPATH with FILENAME_MAX seems to clear up that one.