Is dp declared as follows : struct direct *dp ; Then you need a line like #include <sys/dir.h> at the begining of your file. Good luck, Sylvain.