Check your header files: I suspect that the fault is in "dirent.h" and it's being spotted in the main code.
To check, comment out the #include line and recompile - it won't compile correctly, but the error will move to the
DIR *mydir;
line in all probability.
Then look closely at the content of the .h file, and see if you can spot what you mistyped - it may be as simple as a missing ";".