I want to use #include
in my code but this error happen:
Cannot open include file: \'dirent.h\': No such file or director
This is another light-weight dirent.h implementation for Windows. It is two files that you can just drop in as-is.
Currently, the best way of getting full POSIX support on Windows is probably Cygwin or its friends.
There is Windows Services for UNIX (SfU), but according to some it was quite close to what Cygwin was in 2006. Seeing how Cygwin and some of its comrads are live and well and SfU did not see an update in over half a decade, I would choose the former any day of the week.
If you are interested in a blast from the past, checkout this little nugget from 2006 which is Microsoft's official How to port from UNIX to Windows website. It seems rather useless, but funny what Microsoft thought is "useful" in 2006.
Because this header file doesn't come with MSVC. Hence it cannot find it!
It comes with C POSIX library. The wikipedia says,
dirent.h is known to be included in the following compilers:
- Turbo C++ (DOS)
- GCC (Cross-platform)
- MinGW (Microsoft Windows)
- Borland C++ Builder (Microsoft Windows)
Microsoft Visual C++ does not include dirent.h
However, you can download free Windows implementation of dirent.h which you can use with Microsoft Visual Studio.